Repository navigation
Description
Found while implementing #714. The operator families are now complete, which makes the
remaining gap a producer gap rather than an evaluation gap: an operator can only be as useful
as the keys it can compare, and the keys substrate's own bundled policies condition on have no
producer at all.
The bundled catalog conditions on six keys substrate never populates
All 32 Condition blocks in emulator/iam_managed.go use operators substrate now evaluates,
so no bundled decision changed in v0.107.0. But every key they name is absent from the request
context:
| Key | Named by |
|---|---|
iam:PassedToService |
The iam:PassRole grants |
iam:AWSServiceName |
The service-linked-role grants |
aws:CalledViaLast |
The via-service grants |
elasticloadbalancing:CreateAction |
The ELB tag-on-create grant |
devops-guru:ServiceNames |
The DevOps Guru grant |
ec2:ResourceTag/<key> |
The EC2 grants — substrate produces aws:ResourceTag/<key> |
Each is a false deny, and today in the safe direction: all 32 blocks sit on an Allow, so such
a statement grants nothing rather than a Deny going inert. That safety is a property of the
current catalog, not of the design — one bundled Deny with a condition would invert it.
ec2:ResourceTag/<key> is the cheapest and most valuable: substrate already resolves
aws:ResourceTag/<key> from each resource the request names, so the EC2-scoped spelling is the
same lookup under a second prefix. AWS documents both, and its own examples use the
service-scoped form.
No policy-variable substitution
A ${aws:username} in a resource ARN or a condition value is compared literally. The bundled
IAMUserChangePassword policy (emulator/iam_managed.go:126) scopes its Resource to
arn:aws:iam::*:user/${aws:username}, so it matches no user. AWS substitutes the value before
evaluating. Documented in docs/services.md as of v0.107.0; not implemented.
Note the ordering constraint: substitution needs aws:username to have a producer, which is
the first half of this issue.
No write-time validation of operator names
Real IAM rejects {"NotAnOperator": {...}} with MalformedPolicyDocument when the document is
submitted. Substrate accepts it, stores it, and discards it at evaluation — where v0.107.0 now
makes it deny rather than (under a set qualifier) grant. Denying is the safe reading, but the
refusal belongs at PutUserPolicy/CreatePolicy time, where a caller can act on it.
One caution, from #714: iam_set_qualifiers_test.go:234 pins "forallvalues:StringEquals" as a
non-match at evaluation. AWS's case-insensitivity covers condition-key names, not operator
names (#704), so validating operator names must not move that assertion to submission without
deciding deliberately that it should.
Acceptance criteria
-
ec2:ResourceTag/<key>is populated alongsideaws:ResourceTag/<key>from the same
resource lookup, and the bundled EC2 grants are shown to evaluate. - Each remaining key either gets a producer or is documented as unproducible with the reason.
- Policy-variable substitution for the keys that have producers, or a recorded decision not
to implement it. - Write-time operator-name validation answering
MalformedPolicyDocument, with the
forallvalues:assertion's placement decided explicitly. -
docs/services.md's producer table and the no-producer list updated to match.
Activity
fix(iam,ec2): the bundled policies' condition keys (#730) (#751)
scttfrdmn commentedon Aug 22, 2026
Shipped in v0.108.0 (#751). All five acceptance criteria are met; two carry a caveat worth
recording, both filed rather than left implicit.
ec2:ResourceTag/<key>populated from the same tag set — done, and it needed more than theone-line addition the issue predicted. The prefix alone was inert: authorization resolved an EC2
request to a real ARN and to that resource's tags only when the request named
InstanceId, andthe operations the two bundled statements govern name none of them that way.
GroupId,RouteTableIdandInternetGatewayIdnow resolve too, through one lookup shared by the ARNbuilder and the tag reader.
Caveat: a policy of your own written against
ec2:ResourceTag/<key>now evaluates end to end(verified live), but
ManagedCloudformationResourcesCleanupPolicy's own statement is stillunsatisfiable for a second, independent reason — nothing in substrate produces the
aws:cloudformation:stack-nametag it names.CreateTagsrefuses a caller-suppliedaws:keyexactly as AWS does, and the CloudFormation deployer does not tag the resources a stack creates.
Filed as cfn: the deployer does not apply stack tags to the resources it creates #746.
AmazonEKSClusterPolicyENIDeletelikewise stays inert, because substrate storesno standalone taggable ENI record.
A producer or a documented reason for each remaining key — documented, and the census in the
issue was one short:
codestar-notifications:NotificationsForResource(6 of the 32 conditionblocks, the third-largest group) was absent from
docs/entirely. The table now carries sixrows, each with its reason. The two most feasible are filed: iam: CreateServiceLinkedRole, so iam:AWSServiceName has a producer #747
(
CreateServiceLinkedRole→iam:AWSServiceName, 11 blocks) and elbv2: tagging, so elasticloadbalancing:CreateAction has a producer #748 (ELB tagging →elasticloadbalancing:CreateAction).Policy-variable substitution, or a recorded decision not to — the second alternative, with
the reasoning in
docs/services.md: for the one bundled policy that uses a variable, AWS's ownrule ("an unresolved variable in
Resourcewill not match any resource") means substrate'sliteral comparison already gives AWS's answer. The divergence that remains is
NotResourceandnegated operators, where AWS says an unresolved variable does match. The ordering constraint
is stated honestly:
aws:usernameneeds a producer first, and it cannot be the ARN's lastcomponent — that yields the session name for an assumed role, where AWS documents
aws:usernameas absent. Filed as iam: policy variables are compared literally, so a negated ${aws:username} is more permissive than on AWS #745.Write-time operator-name validation — all four submitting paths (
CreateRole,UpdateAssumeRolePolicy,CreatePolicy, and the shared handler behindPutUserPolicy/PutRolePolicy/PutGroupPolicy) answerMalformedPolicyDocument/ 400 namingthe operator, and store nothing. The vocabulary is not restated: recognition asks the evaluator
itself, so the two cannot drift. Validation is on the submission paths only, never in
PolicyDocument.UnmarshalJSON, which also runs on every read from state — validating therewould make an already-stored document permanently unloadable.
iam_set_qualifiers_test.go's"forallvalues:StringEquals"assertion stays at evaluation and stays green: AWS'scase-insensitivity covers condition key names, not operator names. Predicted blast radius
across the suite was 0 test failures; observed 0.
docs/services.mdupdated — the producer table gainsec2:ResourceTag/<key>, theno-producer list became a table with a reason per key, and a new subsection records which
request parameters resolve to a resource and which still resolve to
*, each with its reason.feat(cloudformation,ec2): stamp aws:cloudformation:* on the EC2 resou…