generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 24
Fix host header port mismatch in signing #578
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
Merged
SamRemis
merged 11 commits into
smithy-lang:develop
from
SamRemis:bugfix-sign-with-netloc
Oct 22, 2025
Merged
Fix host header port mismatch in signing #578
SamRemis
merged 11 commits into
smithy-lang:develop
from
SamRemis:bugfix-sign-with-netloc
Oct 22, 2025
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
jonathan343
reviewed
Oct 17, 2025
jonathan343
reviewed
Oct 17, 2025
…ient if it adds the header
25c7c09 to
2b60ae6
Compare
jonathan343
approved these changes
Oct 22, 2025
alexgromero
pushed a commit
to alexgromero/smithy-python
that referenced
this pull request
Oct 24, 2025
SamRemis
added a commit
that referenced
this pull request
Nov 3, 2025
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.
This PR includes a bugfix which breaks signing any requests that are sent to a non-default port.
Problem:
There's a mismatch between the host header used for signing vs. the actual request header when connecting to non-default ports.
• During signing: The host header includes port (from URI netloc) and gets added to signed headers. The header does not get added to the final request.
• During request creation: The host header excludes port (from URI host) if not already present.
• Result: The request is signed with
example.com:8080but sent with the host header having a value ofexample.com. This creates a signature validation issue server-side.Solution:
This PR updates the CRT client to use netloc, similar to the signer. These values should always match if a given HTTP client is compliant with the HTTP RFCs.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.