Repository navigation
Description
Found while verifying #730's ec2:ResourceTag/<key> work with a live SDK run.
ManagedCloudformationResourcesCleanupPolicy — a statement inside the bundled
AmazonECS_FullAccess (emulator/iam_managed.go:1044-1056) — allows
ec2:DeleteInternetGateway, ec2:DeleteRoute, ec2:DeleteRouteTable and
ec2:DeleteSecurityGroup where ec2:ResourceTag/aws:cloudformation:stack-name is like
EC2ContainerService-*. After #730, both aws:ResourceTag/<key> and ec2:ResourceTag/<key>
report a resolved EC2 resource's tags, and a policy written against a caller-settable key
evaluates correctly end to end (verified live: a StringLike on ec2:ResourceTag/Stack
allows DeleteSecurityGroup/DeleteRouteTable on a matching resource and denies on a
non-matching one).
But that particular statement still cannot be satisfied, because nothing in substrate ever
produces the tag it names:
CreateTagsrefuses a key beginning withaws:— "Tag keys starting with 'aws:' are
reserved for internal use" — which matches AWS, so a caller cannot set it.- Substrate's CloudFormation deployer never applies
aws:cloudformation:stack-name(or
aws:cloudformation:stack-id/aws:cloudformation:logical-id) to the resources a stack
creates:grep -rn 'aws:cloudformation:stack-name' emulator/finds only the managed-policy
statement and the comment inauthz.gothat names it.
Real AWS applies all three tags to every stack-managed resource that supports tagging. They
are observable through DescribeTags/Describe* and they are what tag-scoped policies like
the one above are written against, so their absence is a gap a consumer sees.
Acceptance criteria
- The CFN deployer applies
aws:cloudformation:stack-name,aws:cloudformation:stack-id
andaws:cloudformation:logical-idto the resources it creates, for the resource types
whose creates substrate can tag, through the same internal path that bypasses the
caller-facingaws:-prefix refusal. - The refusal for a caller-supplied
aws:-prefixed key is unchanged. - A test deploys a stack, reads a created resource's tags, and asserts the three values
against the stack's own name and ID. - A test shows
ManagedCloudformationResourcesCleanupPolicygranting a delete on a
resource created by a stack namedEC2ContainerService-*and denying it on one created
by a stack with any other name — i.e. the bundled statement becomes satisfiable. -
docs/services.mddrops the caveat iam: the keys the bundled policies condition on have no producer #730 added under "An operation naming one resource
by ID is decided against that resource".
Activity