Files
floci/tools
Priamo Germosen 1a52438dbc fix(iam): read API Gateway's stored tags and the tags its V1 resources inherit (#9903)
The request-resources table gives resource-tag keys to 66 API Gateway types, but API Gateway gave IAM no tags, so an
aws:ResourceTag condition on an apigateway action never matched. Its Developer Guide also says that in the V1 API "child
resources inherit the tags that are set on parent resources", naming RestApi, DomainName and UsagePlan as the parents,
and that a stage's own tag "takes precedence" over the one it inherits.

ApiGatewayStoredResourceArns reads ApiGatewayService.storedTags and ApiGatewayV2Service.storedTags: the tags of the
caller's REST API, stage, custom domain name, API key, usage plan or VPC link, and of an HTTP or WebSocket API and its
stages, by the first segment of the ARN's resource path, in its Region, read in place from each store with
readInAccount, no legacy entry moved. The REST API's tag writes and the V2 service's now hold the service's monitor and
replace the tag map instead of changing it in place, as the custom domain's, VPC link's, API key's and usage plan's
already did, so a read copies a map no writer changes.

tools/aws/fetch_apigateway_tag_inheritance.py vendors the guide's sentences into
tools/aws/sources/apigateway-tag-inheritance.json, refusing a reworded page. The generator gives each type whose
resource path continues a parent the page names past a '/' that parent, with the parent's format in the type's variable
names (tagParents), from the formats alone: 27 types under RestApi, the 5 under DomainName the guide lists and 4 under
UsagePlan; the V2 API's are under none. RequestResourceMembers reads it, and IamConditionContextResolver lays an ARN's
own tags over its parent's, the parent's ARN filled from the ARN.

The regeneration also takes the Service Reference's new ec2:FailoverVolumes.

test_fetch_apigateway_tag_inheritance.py checks the fetcher's copy and refusals; test_regen_iam_request_resources.py the
parent formats, the parents given and the check of them; RequestResourceMembersTest the read and refusals;
IamConditionContextResolverTest that a method has its REST API's tags under its own and a V2 route none;
ApiGatewayStoredResourceArnsTest each kind's read, a custom domain name and a VPC link of either API, a legacy usage
plan read in place, and its copy; ApiGatewayPathArnEnforcementIntegrationTest that a caller allowed apigateway:GET on
team=blue reads the blue REST API, its resources and a blue HTTP API, and is refused the red REST API, its resources and
the HTTP API's routes.
2026-12-01 09:29:43 -04:00
..