Skip to content

fix(iam): PathPrefix + pagination in ListAttached*Policies#1999

Merged
vieiralucas merged 1 commit into
mainfrom
wt-iam-paths
Jun 27, 2026
Merged

fix(iam): PathPrefix + pagination in ListAttached*Policies#1999
vieiralucas merged 1 commit into
mainfrom
wt-iam-paths

Conversation

@vieiralucas

@vieiralucas vieiralucas commented Jun 27, 2026

Copy link
Copy Markdown
Member

2026-06-27 bug-hunt Tier 1 finding 1.15.

ListAttachedRolePolicies / ListAttachedUserPolicies / ListAttachedGroupPolicies hardcoded IsTruncated=false and ignored PathPrefix, Marker, and MaxItems. boto3 paginators and terraform treated page 1 as the complete set, and PathPrefix queries returned unfiltered data.

Add a shared paginate_attached_policies helper: filter by the path embedded in each policy ARN, marker-cursor by ARN, MaxItems-bounded; render IsTruncated + Marker from it across all three handlers.

Test: attach two policies on different paths to a role; PathPrefix selects only the matching one; MaxItems=1 truncates with a marker and the second page returns the rest (each attachment exactly once). IAM unit suite (496) green.


Summary by cubic

Fixes IAM ListAttachedRolePolicies/UserPolicies/GroupPolicies to honor PathPrefix and real pagination (Marker/MaxItems). Restores correct filtering and makes boto3 and Terraform paginators behave correctly.

  • Bug Fixes
    • Added shared paginate_attached_policies to filter by policy ARN path, paginate by ARN cursor, respect MaxItems, and emit IsTruncated + Marker.
    • Wired the helper into all three list operations so they no longer hardcode IsTruncated=false or ignore PathPrefix, Marker, MaxItems.
    • Added an e2e test covering PathPrefix filtering and two-page pagination.

Written for commit 09e73b3. Summary will update on new commits.

Review in cubic

…up}Policies

These three ops hardcoded IsTruncated=false and ignored PathPrefix, Marker, and
MaxItems, so boto3 paginators and terraform treated page 1 as the complete set
and PathPrefix queries returned unfiltered data. Add a shared
paginate_attached_policies helper (filter by the policy ARN's embedded path,
marker-cursor by ARN, MaxItems-bounded) and render IsTruncated + Marker from it.

Test: attach two policies on different paths to a role; PathPrefix selects only
the matching one; MaxItems=1 truncates with a marker and the second page returns
the rest, each attachment appearing exactly once.
@vieiralucas vieiralucas merged commit 29518ad into main Jun 27, 2026
104 checks passed
@vieiralucas vieiralucas deleted the wt-iam-paths branch June 27, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant