Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Policy variables in Resource and NotResource are not expanded

Đang mở
#533 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

@LeeroyHannigan đang làm issue này rồi.

Từ ngày 24/10/2026.

  • #535 của @LeeroyHannigan — đang mở

Đánh giá

Issue này chưa được đánh giá.

Mô tả

A policy variable in a statement's Resource or NotResource is never expanded. resource_matches in crates/auth/src/policy/evaluator.rs passes each pattern to arn_match as written, so arn:aws:dynamodb:us-east-1:123456789012:table/${aws:PrincipalTag/team} is compared as literal text and matches no table. expand_policy_variables in condition.rs expands variables in condition values only.

On every operation, a Deny written on a variable resource denies nothing, and an Allow written that way grants nothing. With Allow dynamodb:* on * and Deny dynamodb:GetItem on table/${aws:PrincipalTag/team}, a caller tagged team=blue can read table blue.

IAM's rule, measured with aws iam simulate-custom-policy on 2026-10-24 (action dynamodb:GetItem, Allow dynamodb:* on * beside the statement under test):

Statement Context Resource IAM
Deny table/${aws:PrincipalTag/team} team=blue table/blue explicitDeny
same team=blue table/red allowed
same no team tag table/blue allowed
Deny table/${aws:PrincipalTag/team}* team=blue table/blue-x explicitDeny
Allow only table/${aws:username} aws:username=alice table/alice allowed
same aws:username=alice table/bob implicitDeny
Deny table/${aws:PrincipalTag/team}, Version 2008-10-17 team=blue table/blue allowed
same, no Version team=blue table/blue allowed
Deny with NotResource table/${aws:PrincipalTag/team} team=blue table/blue allowed
same team=blue table/red explicitDeny
Deny table/${aws:PrincipalTag/team, 'none'} no team tag table/none explicitDeny

IAM expands variables in Resource and NotResource for a 2012-10-17 document and leaves them literal for 2008-10-17 or no Version; a wildcard after a variable still matches; a variable whose key the request does not carry makes the pattern match nothing; and the ${key, 'default'} form expands to its default when the key is absent. expand_policy_variables does not read the default form either, so a condition value written that way has the same gap.

Fix: expand variables in Resource and NotResource patterns for 2012-10-17 documents before arn_match, with an unresolved variable making that pattern match nothing, and read the ${key, 'default'} form in both places. Tests for each row above.

Ngôn ngữ chính
Rust
Star
517
Fork
60
Merge trung bình
2 ngày 23 giờ
Pull request đã merge (30 ngày)
25

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ExtendDB/extenddb

Tất cả issue của ExtendDB/extenddb

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.