Files
floci/src/main/java/io/github/hectorvent
Jay 7f51c746cd fix(cloudformation): provision AWS::ApiGatewayV2::Authorizer and wire Route.AuthorizerId (#1760)
* fix(cloudformation): provision AWS::ApiGatewayV2::Authorizer and wire Route.AuthorizerId

CloudFormationResourceProvisioner had no case for AWS::ApiGatewayV2::Authorizer,
so the resource fell through the default stub branch and never reached
ApiGatewayV2Service — the same failure mode #788/#796 fixed for the v1
AWS::ApiGateway::Authorizer type. Stacks reported CREATE_COMPLETE, but
apigatewayv2 get-authorizers came back empty and routes referencing the
authorizer carried no authorizerId, so a JWT-authorized route silently
served every request unauthenticated.

Adds provisionApiGatewayV2Authorizer, modeled on the neighboring v2
Route/Integration/Stage provisioners, mapping the CFN PascalCase properties
(Name, AuthorizerType, IdentitySource, JwtConfiguration, AuthorizerUri,
AuthorizerPayloadFormatVersion, AuthorizerResultTtlInSeconds,
EnableSimpleResponses) onto the existing ApiGatewayV2Service.createAuthorizer
camelCase request shape. Also fixes provisionApiGatewayV2Route, which built
its request map without reading AuthorizerId at all even though
ApiGatewayV2Service.createRoute/updateRoute already handle it.

Fixes #1758.

* fix(cloudformation): accept scalar IdentitySource on ApiGatewayV2 Authorizer

resolveStringListOrEmpty silently returned an empty list when a template
supplied IdentitySource as a bare scalar string rather than the documented
array form, dropping the identity source instead of persisting it.
ApiGatewayV2Service.createAuthorizer/updateAuthorizer already accept a
scalar string for identitySource (identitySourceRaw instanceof String), so
the CFN provisioner was stricter than the service it calls.

Adds resolveIdentitySource, a local resolver that accepts both a scalar
string and an array. Adds a regression test asserting the scalar form is
persisted, alongside strengthening the existing test to assert
IdentitySource itself (previously unchecked).

Addresses review feedback on #1760.

* fix(cloudformation): populate AuthorizerId attribute, add scoped delete for AWS::ApiGatewayV2::Authorizer

- Fn::GetAtt Authorizer.AuthorizerId now resolves: provisionApiGatewayV2Authorizer
  only set the physical id, never the resource's attributes map, so GetAtt (which
  reads a separate map from Ref) fell back to a literal placeholder string.

- Stack deletion now actually removes the authorizer: the generic type/physicalId
  delete switch had no case for AWS::ApiGatewayV2::Authorizer at all and silently
  no-op'd. Added a scoped case in delete(StackResource, region) following the same
  shape already used for AWS::EKS::Nodegroup (a resource needing extra context
  beyond type+physicalId, stored as an attribute during provisioning).

Both fixes store ApiId as a resource attribute during provisioning, since it's
needed by the new delete path and wasn't previously retained anywhere.

* fix(apigateway): support $request.querystring.* identity sources for JWT authorizers

extractToken only checked HttpHeaders — it had no query-parameter access at all, so
any IdentitySource entry like $request.querystring.token was silently unusable, and
a request using a valid token there always 401'd. Threads UriInfo through
enforceJwtAuthorizer/extractToken and adds a $request.querystring. branch mirroring
the one enforceRequestAuthorizerV2 already has for Lambda REQUEST authorizers.

* chore: retrigger CI

The Build and Test job failed on a single flaky error in
RuntimeApiServerTest.extensionRegister_racedAgainstStop_eventuallyDeliversShutdown
(EOFException on an HTTP/2 read while racing extension registration against
server stop) — 1 of 8325 tests. This branch changes no Lambda code; that test
is from #1773 and lives on main independently. Passes locally on repeat runs.
2026-08-05 22:23:47 -05:00
..