Skip to content

fix(data_classes): support path parameters in APIGatewayAuthorizerResponse#8001

Open
abhu85 wants to merge 1 commit intoaws-powertools:developfrom
abhu85:fix/api-gateway-proxy-path-7979/2026-02-20
Open

fix(data_classes): support path parameters in APIGatewayAuthorizerResponse#8001
abhu85 wants to merge 1 commit intoaws-powertools:developfrom
abhu85:fix/api-gateway-proxy-path-7979/2026-02-20

Conversation

@abhu85
Copy link

@abhu85 abhu85 commented Feb 20, 2026

Summary

Update the path_regex pattern in APIGatewayAuthorizerResponse to support API Gateway path parameters including:

  • Standard path parameters: {param}
  • Greedy path parameters: {proxy+}

Previously, the regex r"^[/.a-zA-Z0-9-_\*]+$" did not allow {, }, or + characters, causing allow_route and deny_route to reject valid API Gateway resource paths like /{proxy+}.

Root Cause

The regex pattern at line 440 in api_gateway_authorizer_event.py was too restrictive and didn't account for path parameter syntax that API Gateway supports.

Changes

  • Updated path_regex to r"^[/.a-zA-Z0-9-_\*{}+]+$" to allow path parameters
  • Added docstring explaining supported path formats
  • Added 3 test cases for path parameter scenarios

Test Plan

  • All 16 tests pass (pytest tests/unit/data_classes/required_dependencies/test_api_gateway_authorizer.py)
  • Verified exact issue case works: builder.allow_route(http_method='GET', resource='/{proxy+}')
  • Linting passes (ruff check)
  • Formatting passes (ruff format --check)

Fixes #7979


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

…ponse

Update the path_regex pattern to support API Gateway path parameters
including standard path parameters ({param}) and greedy path parameters
({proxy+}). Previously the regex would reject these valid resource paths.

The updated regex allows {, }, and + characters in addition to the
existing allowed characters (/, ., alphanumerics, -, _, *).

Fixes aws-powertools#7979

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Claude OSS Fixer <noreply@anthropic.com>
@abhu85 abhu85 requested a review from a team as a code owner February 20, 2026 12:45
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 20, 2026
@boring-cyborg boring-cyborg bot added the tests label Feb 20, 2026
@boring-cyborg
Copy link

boring-cyborg bot commented Feb 20, 2026

Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: APIGatewayAuthorizerResponse allow_route do not support /{proxy+} resource

2 participants

Comments