Repository navigation
Replace S3 remote signer headers instead of appending them - #4270
Open
Ankitraj-builds wants to merge 1 commit into
Open
Ankitraj-builds wants to merge 1 commit into
Ankitraj-builds wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Closes #2422
Rationale for this change
S3V4RestSigneradds the headers returned by the signing service withadd_header, which appends. A header the request already had, such asX-Amz-Content-SHA256set by botocore, is then sent twice: once with the original value and once with the signed value. The signature only covers the signed value, so stricter S3-compatible stores reject the request. The same duplication was measured in #3896.This deletes the existing header (case-insensitive) before adding the signed value, so each signed header is sent once, with the value the signer returned.
Are these changes tested?
Yes.
test_s3v4_rest_signer_replaces_existing_headersintests/io/test_fsspec.pysends a request that already hasX-Amz-Content-SHA256andUser-Agent, and checks that after signing each header appears once with the signed value. It fails on main and passes with this change. All signer tests in the file pass.Are there any user-facing changes?
Signed S3 requests no longer carry duplicate headers. No configuration changes.