-
Notifications
You must be signed in to change notification settings - Fork 11
fix: missing headers return 400 bad request #26
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -328,9 +328,12 @@ def _get_signed_canonical_headers(self) -> Tuple[str, str]: | |
| canonical_headers = {} | ||
|
|
||
| for signed_header in self.upstream_auth_info.signed_headers: | ||
| canonical_headers[signed_header] = self.upstream_request.headers[ | ||
| signed_header | ||
| ] | ||
| try: | ||
| canonical_headers[signed_header] = self.upstream_request.headers[ | ||
| signed_header | ||
| ] | ||
| except KeyError: | ||
| raise HTTPError(400, message=f"Bad Request") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we provide more information about the failure that happened, like the fact that the Would that be too much information or would it be a security issue to provide?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't expect a keyerror unless it is intentionally malformed request so we chose to return a generic 400. We don't expect customers to malform request, so this is fine
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Who is generating the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tracking improvements of better error message with header specification in https://t.corp.amazon.com/P74816551
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Discussed with Daniel on a call, this will be taken as a followup item to either:
|
||
|
|
||
| base_service_url = urlparse(self.service_info.endpoint_url) | ||
| canonical_headers["host"] = base_service_url.netloc | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to avoid a
module 'asyncio' has no attribute 'coroutine'error when using Python 3.11 to build. The previous #25 used 3.10 and was successfully deployed.