Repository navigation
Exclude additional hop-by-hop headers from SigV4 signing - #3643
Merged
Merged
Conversation
ubaskota
reviewed
Mar 3, 2026
Comment on lines
+410
to
+434
| def test_blocklist_connection_header(self): | ||
| self._test_blocklist_header('connection', 'keep-alive') | ||
|
|
||
| def test_blocklist_keep_alive_header(self): | ||
| self._test_blocklist_header('keep-alive', 'timeout=5') | ||
|
|
||
| def test_blocklist_proxy_authenticate_header(self): | ||
| self._test_blocklist_header( | ||
| 'proxy-authenticate', 'Basic realm="proxy.example.com"' | ||
| ) | ||
|
|
||
| def test_blocklist_proxy_authorization_header(self): | ||
| self._test_blocklist_header( | ||
| 'proxy-authorization', 'Basic YWxhZGRpbjpvcGVuc2VzYW1l' | ||
| ) | ||
|
|
||
| def test_blocklist_te_header(self): | ||
| self._test_blocklist_header('te', 'trailers') | ||
|
|
||
| def test_blocklist_trailer_header(self): | ||
| self._test_blocklist_header('trailer', 'x-amz-checksum-sha256') | ||
|
|
||
| def test_blocklist_upgrade_header(self): | ||
| self._test_blocklist_header('upgrade', 'websocket') | ||
|
|
Contributor
There was a problem hiding this comment.
Nit: Would parametrized tests work better here, or do you prefer it as is?
Contributor
Author
There was a problem hiding this comment.
I kept individual test methods to match the existing TestS3SigV4Auth style and make failures easy to pinpoint by test name. Since this file is unittest-style (not pytest-parametrized), I preferred explicit tests here.
aws-sdk-python-automation
added a commit
that referenced
this pull request
Mar 4, 2026
* release-1.42.61: Bumping version to 1.42.61 Update to latest models auth: exclude additional hop-by-hop headers from SigV4 signing (#3643)
hswong3i
pushed a commit
to alvistack/boto-botocore
that referenced
this pull request
Mar 5, 2026
1 task done
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.
Overview
This PR aligns SigV4 header signing behavior with IAM guidance by excluding additional hop-by-hop headers from signature calculation. This prevents signature mismatch failures when intermediaries (for example, proxies or load balancers) mutate transport headers in transit.
Background
Botocore already excluded a subset of volatile headers (
expect,transfer-encoding,user-agent,x-amzn-trace-id), but it did not exclude the full IAM-documented hop-by-hop set.Summary
SIGNED_HEADERS_BLACKLISTinbotocore/auth.py:connectionkeep-aliveproxy-authenticateproxy-authorizationtetrailerupgradetests/unit/auth/test_signers.pyunderTestS3SigV4Authto verify each new header is excluded fromSignedHeaders._test_blocklist_headerto assert against parsedSignedHeaderstokens instead of raw substring matching in the fullAuthorizationheader (avoids false positives for short header names likete)..changes/next-release/enhancement-auth-88913.json.Testing
python -m pytest tests/unit/auth/test_signers.pyGetCallerIdentity):References
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.