Summary
IamGuard (qwed_infra/guards/iam_guard.py, _match_pattern :51-80, condition lookup :175) does not implement AWS IAM matching semantics. Divergences let a Deny statement that AWS would enforce silently drop, so the guard reports allowed=True and mints proof-bearing VERIFIED/ADMIT attestations for forbidden access. Reachable from a plain policy document.
Affected
qwed-infra <= 0.3.0 (verified on main @ b3098be = v0.3.0). No patched version yet.
Details (all: Allow */* plus one Deny)
- Action case: Deny
S3:*does not match actions3:GetObject(exact==; AWS actions are case-insensitive) > allowed=True. Control Denys3:GetObject> False. ?wildcard: Denyarn:aws:s3:::secret-bucke?/*does not match (pattern split on*only;?stays literal, but AWS means one character) > allowed=True.*covers only\x00-\xff: Denysecret-bucket/*does not match non-ASCII keys > allowed=True. Control ASCII key > False.- Policy variables never substituted: Deny
home/${aws:username}/*withaws:username=alicedoes not match (no substitution anywhere in file) > allowed=True. - Condition keys matched case-sensitively (
context.get(key)): DenyIpAddressonaws:sourceipwith context keyaws:SourceIpdoes not match (AWS documents condition key names as case-insensitive) > allowed=True. Same-case control > False.
Impact
A Deny that AWS enforces is dropped and QWED issues a proof-bearing allow (VERIFIED diagnostic + signed attestation + ADMIT verification context). Mirrored Allows give false denials.
Fix direction
Lower-case actions; ? = exactly one character; * over the full Unicode alphabet; substitute ${aws:*} from context (UNVERIFIABLE when unresolvable); case-insensitive condition-key lookup; decode $${ escapes. Regression tests: each variant must deny, mirrored Allows must permit.
CWE
CWE-693 (Protection Mechanism Failure).
