Skip to content

fix: trust-policy checks now match wildcard actions covering sts:AssumeRole - #646

Open
0x5t4l1n wants to merge 1 commit into
salesforce:masterfrom
0x5t4l1n:fix/wildcard-action-trust-policy
Open

0x5t4l1n wants to merge 1 commit into
salesforce:masterfrom
0x5t4l1n:fix/wildcard-action-trust-policy

Conversation

@0x5t4l1n

Copy link
Copy Markdown

Summary

Test plan

  • pytest test/scanning/test_trust_policies.py passes
  • New test_assume_role_wildcard_actions verifies sts:*, sts:AssumeRole*, and * are all detected
  • New test_assume_role_non_matching_wildcard_actions verifies s3:*, ec2:*, sts:AssumeRoleWithSAML are not matched

…meRole

The 4 trust-policy properties on AssumeRoleStatement used exact string
match ("sts:assumerole" not in lowercase_actions) which missed wildcard
actions like sts:*, sts:AssumeRole*, and *. The most permissive trust
policies (wildcard action + Principal "*") were incorrectly reported as
clean.

Added _allows_assume_role() helper using fnmatchcase for case-insensitive
glob matching, and replaced all 4 duplicate checks with calls to this
helper.

Added tests for wildcard and non-matching action patterns.

Fixes salesforce#645

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trust-policy checks miss wildcard actions (sts:*, sts:AssumeRole*, *): Principal "*" role reported as clean

1 participant