mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
* fix(lambdaweb): accept role and user ARNs as resource policy principals AWS checks an ARN principal against a pattern that allows a slash, so a role or user ARN passes. Any other AWS principal value is still checked against the pattern without a slash. * feat(lambdaweb): verify SigV4 and InvokeWebFunctionEndpoint on IamAuth endpoints An IamAuth endpoint takes a request signed for the service lambda in the endpoint's region, in the Authorization header or a presigned query. The X-Amz-Content-SHA256 header is required and is the payload hash, as on AWS. A refused request gets the AWS 403 page with no error type. The check runs after the rateLimit 0 page and before the rate limit. Under IAM enforcement the signer also needs lambda:InvokeWebFunctionEndpoint on the endpoint ARN from its identity policy or the function's resource policy, with the auth type and the function tags as condition keys. An Authorization that is an AWS signature is dropped before the app on every endpoint, together with X-Amz-Security-Token. * fix(lambdaweb): give the app the path without dot segments and sign only the normalized path Lambda removes dot segments before the app sees the path, on every endpoint, and keeps repeated slashes and encoded dots. An IamAuth signature counts only over the path as signers normalize it. A signature over the path as sent is refused when the two differ. Floci forwarded the path as sent and took a signature over either form, so a request signed for /a/c could reach the app as /a/./b/../c. * fix(lambdaweb): answer 502 when the caller check fails inside Floci A malformed date or query is still a refused signature. Any other failure, such as in IAM storage, no longer looks like a 403. The endpoint answers it with 502 and no error type, as AWS answers its own failures. * fix(lambdaweb): check a principal against the ARN pattern only under AWS Lambda allows a path only in an ARN under the AWS key. A CanonicalUser or Federated value never matches that pattern. * docs(lambdaweb): MultiRegion SigV4, presigned queries and dot segments on the way to the app * chore(auth): share SigV4 signature parsing and age limits with API Gateway The API Gateway authorizer and Lambda Web IamAuth read a SigV4 signature from the Authorization header or a presigned query, and check its age, in the same way. Both now use one record in core.common.auth. Each still decides which placement wins and where it reads the session token, so neither behaves differently.