Skip to content

Strip IAM user path when deriving aws:username (#15) - #19

Merged
jplock merged 2 commits into
mainfrom
fix/issue-15-username-path
May 31, 2026
Merged

Strip IAM user path when deriving aws:username (#15)#19
jplock merged 2 commits into
mainfrom
fix/issue-15-username-path

Conversation

@jplock

@jplock jplock commented May 31, 2026

Copy link
Copy Markdown
Member

Fixes #15


Note

Low Risk
Localized ARN parsing fix for one policy variable with added regression tests; no auth or broad eval redesign.

Overview
Fixes ${aws:username} when the principal is an IAM user whose ARN includes a path (e.g. user/developers/johndoe). Previously the whole suffix after user/ was used as the username; it now returns only the final path segment, matching AWS behavior (usernames cannot contain /).

Assumed-role and federated-user ARN handling is unchanged. New unit tests cover flat, single-segment, and deep IAM user paths.

Reviewed by Cursor Bugbot for commit cef8bf5. Bugbot is set up for automated code reviews on this repo. Configure here.

@jplock
jplock merged commit 8660f28 into main May 31, 2026
10 checks passed
@jplock
jplock deleted the fix/issue-15-username-path branch May 31, 2026 17:28
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.

[Detail Bug] Policy variable ${aws:username} evaluates incorrectly for IAM users with paths

1 participant