Repository navigation
rgw/auth: don't require x-amz-content-sha256 in signed headers - #71292
Conversation
|
i'd like to add a test case to validate this and catch future regressions |
|
updated with test cases that include and omit this header from the signature. both test cases pass with the fix applied. without the fix, the test case that omits the header fails as expected:
|
that's not on my branch, so i'll rebase and debug |
aws sigv4 does not require s3 requests to sign x-amz-content-sha256 because it's already present in the canonical request as HashedPayload Fixes: https://tracker.ceph.com/issues/79803 Signed-off-by: Casey Bodley <[email protected]>
| /* botocore's query signer doesnt sign x-amz-content-sha256, so a | ||
| * presigned URL is exactly where forging it would matter. */ | ||
| EXPECT_FALSE(canonicalize_presigned( | ||
| {{"HTTP_X_AMZ_CONTENT_SHA256", "UNSIGNED-PAYLOAD"}}, boto2)); |
There was a problem hiding this comment.
cc @elliotcourant, my fix was causing this new test case to fail
the s3 doc for this query-based auth in https://docs.aws.amazon.com/AmazonS3/latest/developerguide/sigv4-query-string-auth.html just uses a hard-coded UNSIGNED-PAYLOAD for the PayloadHash part of the canonical request, so x-amz-content-sha256 is not consulted there. only for header-based auth in https://docs.aws.amazon.com/AmazonS3/latest/developerguide/sigv4-auth-using-authorization-header.html does it say that x-amz-content-sha256 is required
in rgw, i do see that AWSGeneralAbstractor::get_auth_data_v4() calls get_v4_exp_payload_hash() even when bool using_qs is true, so will calculate the server signature based on the value of x-amz-content-sha256 if it's given. but i assume that any value other than UNSIGNED-PAYLOAD, whether forged or not, would lead to a signature mismatch
so i still think it's safe to remove this enforcement that x-amz-content-sha256 is signed, along with this test case. what do you think?
There was a problem hiding this comment.
I believe that you are correct yes, that test was a bit overdone just to be safe; but with the other test expects remaining i think its still good and this is safe to remove.
Sorry this caused a headache here!
There was a problem hiding this comment.
thanks Elliot - no worries, the test reflected what the code was enforcing. i just didn't want to change it without your ack
|
jenkins test make check |
|
passed qa in https://pulpito.ceph.com/cbodley-2026-08-24_20:23:05-rgw-wip-79803-distro-default-trial/ with 3 known issues:
verified that new test cases ran and passed:
|
aws sigv4 does not require s3 requests to sign x-amz-content-sha256 because it's already present in the canonical request as HashedPayload
Fixes: https://tracker.ceph.com/issues/79803
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.