From 2969d1a25df60bf05c76e4ba7f6949917a486300 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Mon, 21 Nov 2022 11:17:50 +0100 Subject: [PATCH 1/2] fix(apigateway): support dynamic routes with equal sign (RFC3986) --- tests/functional/event_handler/test_api_gateway.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/event_handler/test_api_gateway.py b/tests/functional/event_handler/test_api_gateway.py index 76174909b01..61c2f715b18 100644 --- a/tests/functional/event_handler/test_api_gateway.py +++ b/tests/functional/event_handler/test_api_gateway.py @@ -909,7 +909,7 @@ def get_network_account(account_id: str, network_id: str): [ pytest.param(123456789, id="num"), pytest.param("user@example.com", id="email"), - pytest.param("-._~'!*:@,;()", id="safe-rfc3986"), + pytest.param("-._~'!*:@,;()=", id="safe-rfc3986"), pytest.param("%<>[]{}|^", id="unsafe-rfc3986"), ], ) From 93c952ca9db9846290e84cbc6d99a4c591c68e60 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Mon, 21 Nov 2022 11:26:10 +0100 Subject: [PATCH 2/2] chore: add actual fix now that tests failed in CI --- aws_lambda_powertools/event_handler/api_gateway.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws_lambda_powertools/event_handler/api_gateway.py b/aws_lambda_powertools/event_handler/api_gateway.py index 5b91a1583d4..f96b8789308 100644 --- a/aws_lambda_powertools/event_handler/api_gateway.py +++ b/aws_lambda_powertools/event_handler/api_gateway.py @@ -40,7 +40,7 @@ logger = logging.getLogger(__name__) _DYNAMIC_ROUTE_PATTERN = r"(<\w+>)" -_SAFE_URI = "-._~()'!*:@,;" # https://www.ietf.org/rfc/rfc3986.txt +_SAFE_URI = "-._~()'!*:@,;=" # https://www.ietf.org/rfc/rfc3986.txt # API GW/ALB decode non-safe URI chars; we must support them too _UNSAFE_URI = "%<> \[\]{}|^" # noqa: W605 _NAMED_GROUP_BOUNDARY_PATTERN = rf"(?P\1[{_SAFE_URI}{_UNSAFE_URI}\\w]+)"