Disable response checksum validation for custom S3 endpoints#37
Draft
ffittschen wants to merge 1 commit into
Draft
Disable response checksum validation for custom S3 endpoints#37ffittschen wants to merge 1 commit into
ffittschen wants to merge 1 commit into
Conversation
The GHA v2 proxy download re-presigns a GET and fetches it back through the sidecar. With aws-sdk-go-v2's default ResponseChecksumValidation of "when_supported", the presigned GET carries a signed x-amz-checksum-mode=ENABLED query parameter. S3-compatible stores that do not verify that extra signed parameter reject the request with 403 SignatureDoesNotMatch, so every proxied cache restore fails even though the object exists and header-signed requests succeed. Set ResponseChecksumValidation to WhenRequired when a custom endpoint is configured so presigned GETs stay portable across S3-compatible stores; real AWS S3 is unaffected. Add an offline regression test asserting the parameter is absent.
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.
This PR keeps presigned GETs portable across S3-compatible stores by disabling response checksum validation when a custom endpoint is configured.
The root cause is in
newS3Client: the client is built without overridingResponseChecksumValidation, so it keeps aws-sdk-go-v2's default ofWhenSupported. The presign client is derived from that same client (NewS3Storage→s3.NewPresignClient), so presignedGetObjectURLs carry a signedx-amz-checksum-mode=ENABLEDquery param. Some S3-compatible stores don't verify that extra signed parameter and reject the request with403 SignatureDoesNotMatch, so proxied cache restores fail even though the object exists and header-signed requests succeed. This reproduces against SeaweedFS 3.80 (4.38 handles the presigned signature correctly); the param is unnecessary on a proxied download regardless, and real AWS S3 is unaffected.This PR sets
ResponseChecksumValidation = WhenRequiredinnewS3Clientonly when a customBaseEndpointis configured, so presigned GETs stay portable across stores that don't verify the param while leaving real AWS S3 untouched.Fixes #35.
How to test
go test ./internal/commands/ -run TestNewS3ClientCustomEndpointPresignOmitsChecksumModepasses — it asserts a presigned GET for a custom endpoint carries noX-Amz-Checksum-Modeparam (offline; no backend required).go build ./...is clean.go test ./...suite requires Docker/LocalStack (testcontainers) and was not run in my environment.