Skip to content

Commit

Permalink
Merge 0446b87 into 8453062
Browse files Browse the repository at this point in the history
  • Loading branch information
tweedge committed Jun 2, 2021
2 parents 8453062 + 0446b87 commit 65fa6f7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions policyuniverse/statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def _condition_entries(self):
"aws:principalarn": "arn",
"aws:sourceowner": "account",
"aws:sourceaccount": "account",
"aws:principalaccount": "account",
"aws:principalorgid": "org-id",
"kms:calleraccount": "account",
"aws:userid": "userid",
Expand Down
21 changes: 21 additions & 0 deletions policyuniverse/tests/test_statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,19 @@
},
)

# aws:PrincipalAccount in conditions
statement33 = dict(
Effect="Allow",
Principal="*",
Action=["rds:*"],
Resource="*",
Condition={
"ForAnyValue:StringEquals": {
"AWS:PrincipalAccount": ["012345678910", "123456789123"]
}
},
)


class StatementTestCase(unittest.TestCase):
def test_statement_effect(self):
Expand Down Expand Up @@ -477,6 +490,11 @@ def test_statement_conditions(self):
set(["arn:aws:iam::012345678910:role/SomePrincipalRole"]),
)

statement = Statement(statement33)
self.assertEqual(
statement.condition_accounts, set(["012345678910", "123456789123"])
)

def test_statement_internet_accessible(self):
self.assertTrue(Statement(statement14).is_internet_accessible())
self.assertTrue(Statement(statement15).is_internet_accessible())
Expand Down Expand Up @@ -525,3 +543,6 @@ def test_statement_internet_accessible(self):

# AWS:PrincipalARN
self.assertFalse(Statement(statement32).is_internet_accessible())

# AWS:PrincipalAccount
self.assertFalse(Statement(statement33).is_internet_accessible())

0 comments on commit 65fa6f7

Please sign in to comment.