Enable checksum validation for presigned URL downloads#7035
Open
jencymaryjoseph wants to merge 1 commit into
Open
Enable checksum validation for presigned URL downloads#7035jencymaryjoseph wants to merge 1 commit into
jencymaryjoseph wants to merge 1 commit into
Conversation
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.
Motivation and Context
S3 returns checksum headers (x-amz-checksum-crc32, x-amz-checksum-crc64nvme, etc.) only when the request includes x-amz-checksum-mode: ENABLED as an HTTP header. For presigned URL downloads, this header was not being sent because:
HttpChecksumValidationInterceptor) check request instanceof GetObjectRequest, but presigned URL downloads usePresignedUrlDownloadRequestWrapper— a different type — so the interceptor short-circuits.This meant S3 never returned checksums for presigned URL downloads, making data integrity validation impossible.
Modifications
This change adds checksum header auto-detection in the request marshaller and enables response checksum validation through the existing SDK interceptor pipeline.
PresignedUrlDownloadRequestMarshaller):DefaultAsyncPresignedUrlExtension):HttpChecksumValidationInterceptorto validate response checksums. On mismatch, throwsSdkClientException.AsyncPresignedUrlExtension(interface-level): Documents checksum validation behavior and limitations.S3Presigner.presignGetObject(): Documents that enabling checksum mode makes the URL non-browser-executable.Testing
PresignedUrlDownloadRequestMarshallerTest): Verifies header is added when x-amz-checksum-mode is in SignedHeaders, and not added otherwise.PresignedUrlChecksumValidationWiremockTest): Verifies matching checksum succeeds, mismatching checksum throws SdkClientException, and missing checksum skips validation.DefaultAsyncPresignedUrlExtensionTest): Verifies download completes successfully when checksum headers are present.AsyncPresignedUrlExtensionTestSuite): Verifies against live S3 that checksums are returned when checksum mode is enabled and not returned otherwise.Screenshots (if appropriate)
Types of changes
Checklist
mvn installsucceedsscripts/new-changescript and following the instructions. Commit the new file created by the script in.changes/next-releasewith your changes.License