Skip to content

Policy variables in condition values: Version 2008-10-17 and the escapes #534

Closed

Description

@LeeroyHannigan

Two policy variable rules in condition values differ from IAM. Both are in expand_policy_variables in crates/auth/src/policy/condition.rs on main.

  1. A condition value in a 2008-10-17 document, or one with no Version, is expanded. IAM treats a variable there as literal text. evaluate_statement_conditions has no access to the document's Version, so the expansion runs for every document.
  2. ${*}, ${?} and ${$} in a condition value are left as the four-character text. IAM expands them to *, ? and $.

Measured with aws iam simulate-custom-policy on 2026-10-24, action dynamodb:GetItem, Allow dynamodb:* on * beside the statement under test, resource arn:aws:dynamodb:us-east-1:123456789012:table/blue:

Statement Context IAM ExtendDB
Version 2008-10-17, Deny on * if StringEquals aws:ResourceTag/owner: ${aws:username} aws:username=alice, aws:ResourceTag/owner=alice allowed explicitDeny
same with Version 2012-10-17 same explicitDeny explicitDeny
Version 2012-10-17, Deny on * if StringEquals aws:PrincipalTag/team: ${*} aws:PrincipalTag/team=* explicitDeny allowed

Fix: pass whether the document expands policy variables into the condition evaluation, and expand the escapes in condition values. For the escapes, a StringLike or ArnLike value that holds ${*} needs the escaped character to stay literal where a written * is a wildcard, so the comparison has to take the expanded value with its wildcard positions marked rather than a plain string.

Activity

  1. added this to the 1.0 milestone on Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

release-blockerMust ship for its milestone's releasesecurityv1Needed for the 1.0 release

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions