Repository navigation
Conversation
…t uploads S3 requires Content-MD5 or an x-amz-checksum-* header on every write to a bucket with Object Lock, including each UploadPart. The SDK uploader only adds a per-part checksum when ChecksumAlgorithm is set, so dumps over the 5 MiB multipart threshold were refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
|
This looks good in principle, but as you said, I would be concerned about older stores. I think this makes sense as the default, but it would be good to add an option to opt out of it. |
Collaborator
|
Also DCO requires signature. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Uploading a dump larger than the multipart threshold (5 MiB) to an S3 bucket
with Object Lock enabled fails:
S3 requires a
Content-MD5orx-amz-checksum-*header on every write to anObject Lock bucket, including each
UploadPart.manager.Uploaderinaws-sdk-go-v2 only adds a per-part checksum when
ChecksumAlgorithmis set onthe
PutObjectInput, andpkg/storage/s3does not set it. Dumps under 5 MiBgo up as a single
PutObjectand succeed, so the failure only shows once adatabase grows past the threshold.
Object Lock (COMPLIANCE or GOVERNANCE mode) is a common way to make backups
immutable, so this affects anyone using it for ransomware protection or
retention requirements.
Change
Set
ChecksumAlgorithm: types.ChecksumAlgorithmCrc32on the upload input inpkg/storage/s3/s3.go. The uploader then computes a CRC32 for each part andS3 stores a composite checksum for the object.
Testing
Built from v1.5.0 with this change and ran
dump --onceagainst a bucket withObject Lock COMPLIANCE and SSE-KMS default encryption. A ~14 MB dump uploaded
in 3 parts;
s3api get-object-attributesshows aChecksumCRC32compositeover 3 parts, and the object restored cleanly. Without the change the same
upload fails with the error above. The patch applies unchanged to
mainandis
gofmt-clean.Compatibility
CRC32 checksums are supported by AWS S3 and by current MinIO. Some older
S3-compatible stores may reject
x-amz-checksum-*headers; if that is aconcern I'm happy to make the algorithm configurable (for example an
--s3-checksumoption defaulting to CRC32, withnoneto disable) insteadof setting it unconditionally.