Repository navigation
Description
Problem
AWS states plainly, in IAM JSON policy elements: Condition:
For conditions, the condition key is not case-sensitive and the condition value is case-sensitive.
Substrate matches condition-key names case-sensitively. conditionMatches
(emulator/iam_eval.go) looks the key up in the request context map directly, so a policy
that spells a key ec2:createaction, aws:requesttag/Env or AWS:PrincipalArn — every one of
which real IAM evaluates — is silently unmatched here.
The failure direction depends on the effect:
- a Deny written with a differently-cased key name is inert — substrate allows what AWS denies;
- an Allow written that way is an implicit deny — a false refusal.
This is global to the evaluator, not specific to any one key. It was found while implementing
the second ec2:CreateTags pass (#691): a subtest asserting that ec2:createaction still
matches failed, and the comment at emulator/ec2_createtags_authz_test.go:297 records the gap
pointing here.
Scope
The key name is case-insensitive; the key value is not. Only the lookup changes:
conditionMatches/evaluateConditionKey(emulator/iam_eval.go) must resolve a policy's
key name against the request context case-insensitively, for bothContextandMultiContext.Nullmust resolve the same way, or the recommendedForAllValues+Null: falsepattern
breaks for a differently-cased key.unsetConditionKeys(emulator/iam_eval.go) must not report a key as missing merely because
the policy's spelling differs from the producer's.- Tag-suffixed keys need care: the prefix (
aws:RequestTag/,aws:ResourceTag/) is a key
name and case-insensitive, but AWS documents tag keys themselves as case-sensitive, and
substrate's own tag rules (emulator/ec2_tags.go) already treat them so. The suffix must stay
case-sensitive. - Two producers writing the same key with different casing must not both survive into the
context, or a lookup becomes order-dependent — which the event log must never be.
Acceptance criteria
- A policy naming
ec2:createaction,AWS:RequestTag/Envor any other case variant is
evaluated identically to its canonical spelling, in bothAllowandDenyposition. - The tag-key suffix of
aws:RequestTag/*/aws:ResourceTag/*remains case-sensitive, with
a test pinning both halves of that split. -
NullandunsetConditionKeysresolve names the same way asconditionMatches. - The AWS sentence above is quoted at the implementation site as provenance.
-
docs/services.mdstates the rule and the tag-suffix exception; the case-sensitivity
caveat recorded under ec2,iam: the second ec2:CreateTags authorization pass for a resource-creating action that carries tags #691 is replaced by the implemented behaviour. -
CHANGELOG.mdrecords this under### Fixed, noting both failure directions.
Activity
fix(ec2,iam): a tagged create is authorized twice, against ec2:Create…