mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
* fix(apigateway): preserve trailing slash in proxy event path
The REST proxy event path was built from the JAX-RS {proxy} path param, which strips a trailing slash, so a request to /thing/ produced event.path "/thing" instead of "/thing/". A trailing slash is significant to backends that treat /thing and /thing/ as distinct routes. Recover it from the raw request URI for the event path, requestContext.path and the proxy path parameter, while resource matching and path-parameter extraction keep using the normalized path (AWS routes /thing/ to the /thing resource but preserves the slash in the delivered event).
Fixes #1557
* fix(apigateway): preserve trailing slash in the authorizer event path
buildProxyEvent recovers the trailing slash the JAX-RS {proxy} binding
strips, but toAuthorizerEvent still used the normalized path. A CUSTOM
authorizer therefore gated /admin/special while the Lambda received
/admin/special/, so path-based access control in the authorizer and the
handler operated on different strings. Real API Gateway gives both the
raw path.
Use preserveTrailingSlash for the authorizer event's path, methodArn and
requestContext.path; path-parameter extraction still uses the normalized
path, matching buildProxyEvent. Adds an end-to-end regression asserting
the authorizer event path keeps the slash while pathParameters do not.
* fix(apigateway): keep proxy path param and methodArn normalized
Review feedback: pathParameters come from the matcher, which runs on the
normalized path, so the greedy {proxy+} value carries no trailing slash on
real AWS even when event.path keeps one. Independent reports of the AWS
behaviour agree that event.path preserves the slash while
pathParameters.proxy does not.
methodArn is matched against IAM-style policy resources, where a stray
trailing slash would silently fail wildcards an authorizer returns. No AWS
behaviour was found pinning it either way, so it keeps the normalized path.
event.path and requestContext.path still preserve the slash, which is the
part of the original fix the evidence supports.