Repository navigation
fix(data_classes): keep the ARN partition in authorizer from_route_arn - #8947
Open
THEpranavsomalraju wants to merge 1 commit into
Open
THEpranavsomalraju wants to merge 1 commit into
THEpranavsomalraju wants to merge 1 commit into
Conversation
parse_api_gateway_arn returns the partition, but both from_route_arn factories dropped it, so the response was built with the default "aws". An authorizer in aws-cn or aws-us-gov returned a policy for arn:aws:execute-api, which is not the ARN API Gateway invoked.
|
Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need. |
|
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.



Issue number: closes #8946
Summary
Changes
APIGatewayAuthorizerResponse.from_route_arnandAPIGatewayAuthorizerResponseWebSocket.from_route_arnnow passpartition=parsed_arn.partitionto the constructor.parse_api_gateway_arnalready returned the partition and the constructor already accepted it; the two factories dropped it, so every response was built with the default"aws".User experience
Before: an authorizer in
aws-cnoraws-us-govthat builds its response withfrom_route_arn(event.method_arn, ...)returns a policy whose resources start witharn:aws:execute-api:, which is not the ARN API Gateway invoked.After: the policy resources keep the partition of the incoming ARN, e.g.
arn:aws-cn:execute-api:cn-north-1:.... Nothing changes for theawspartition.Verification
Added a parametrized test for
aws,aws-cnandaws-us-govto each of the REST and WebSocket authorizer test files. The four non-commercial cases fail on develop and pass with the change; the rest oftests/unit/data_classes/required_dependenciespasses (221 tests). No existing test was modified.I have not validated this against a live API Gateway in aws-cn or GovCloud, since I don't have an account in those partitions. What I verified is the ARN in the returned policy document.
An AI assistant was used to help find this bug and write the change and tests.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.