s3: validate per-part checksums in CompleteMultipartUpload

Parse the Checksum* elements of each completed part and enforce what AWS
does for uploads created with x-amz-checksum-algorithm: every part must
carry a checksum in the complete request (InvalidRequest when missing,
BadDigest when it differs from the stored part checksum), and an
x-amz-checksum-type header must match the upload resolved checksum type
(BadDigest). Add the issue-11401 reproduction as a regression test.
This commit is contained in:
Chris Lu committed 2026-09-19 22:18:13 -07:00
1 parent 4eb30f3b5b
commit e9d2bdd02b
4 files changed
+168 -2

No files matched your search

+16
View File
@@ -1225,6 +1225,22 @@ func (c *ChecksumResult) SetChecksum(headerName, value string) {
}
}
func (c *ChecksumResult) GetChecksum(headerName string) string {
switch headerName {
case s3_constants.AmzChecksumCRC32:
return c.ChecksumCRC32
case s3_constants.AmzChecksumCRC32C:
return c.ChecksumCRC32C
case s3_constants.AmzChecksumCRC64NVME:
return c.ChecksumCRC64NVME
case s3_constants.AmzChecksumSHA1:
return c.ChecksumSHA1
case s3_constants.AmzChecksumSHA256:
return c.ChecksumSHA256
}
return ""
}
// lookupHeaderOrQuery returns the value of an x-amz-* parameter, checking the
// request headers first and falling back to the pre-parsed query values. AWS
// SDK presigners hoist headers such as x-amz-sdk-checksum-algorithm into the