-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
S3 Object Integrity Algorithms and Presigned URLs #3217
Comments
Thanks for opening an issue. This was an intentional decision because of backwards compatibility and because s3 doesn't support this feature on presigned urls to my understanding. S3 team is aware of this. |
Thanks for the context @mullermp! From my testing, the S3 PutObject API calls do in fact support object integrity checks via presigned URLs if the It feels like a change can be made to the SDK in a non-breaking way to opt in to this behaviour during presigning - for example adding a new optional parameter to presigner = Aws::S3::Presigner.new
presigner.presigned_url(
...,
checksum_algorithm: 'SHA256',
checksum_sha256: 'checksum',
checksum_sign_headers: true
) I'd be happy to submit a PR if you think this is an acceptable approach? |
S3 would like to support it directly using query parameters and not by sending headers. I'll talk with them and other teams. |
Ah makes sense - please let me know if there's anything I can do to support 👍 |
Describe the bug
Hey there - thanks for making a great library!
I'm trying to use the SDK to generate a presigned S3 PUT URL that enforces object integrity as documented using the
SHA256
checksum algorithm.After looking through the source, it appears that the Aws::S3::Presigner does not support generating presigned URLs that specify the
x-amz-checksum-{algorithm}
header as a signed header value.At first glance this feels like a defect, therefore submitting as a bug. Happy to treat this as a feature request though - thanks!
Regression Issue
Expected Behavior
Calling
Aws::S3::Presigner#presigned_url
with achecksum_algorithm
value generates a URL that specifies the necessary checksum headers as signed headers.Current Behavior
Calling
Aws::S3::Presigner#presigned_url
with achecksum_algorithm
value generates a URL with the checksum headers as unsigned headers - meaning that the recipient of the URL can't utilize object integrity checks.Reproduction Steps
Here's a minimal script that demonstrates the issue:
Save the script as
script.rb
and provide two different test files in the same directory (file_one.png
andfile_two.jpeg
).Execute the script as follows:
Possible Solution
Avoid removing the checksum handler and don't hoist the checksum headers when the presigned URL is being generated.
Additional Information/Context
It's worthwhile to note that the
Content-MD5
header is treated as a signed header for presigned URLs. This is different than the behaviour when a different algorithm is specified.Gem name ('aws-sdk', 'aws-sdk-resources' or service gems like 'aws-sdk-s3') and its version
aws-sdk-s3, 1.182.0
Environment details (Version of Ruby, OS environment)
Ruby 3.3.6, MacOS 15.3.2
The text was updated successfully, but these errors were encountered: