Fix multiple IAM Policy Statement creation with empty sid

This commit is contained in:
Bruno Oliveira 2019-09-10 23:43:50 -03:00
parent 3a5d857a60
commit 21933052d3
2 changed files with 21 additions and 2 deletions

View File

@ -152,8 +152,10 @@ class IAMPolicyDocumentValidator:
sids = [] sids = []
for statement in self._statements: for statement in self._statements:
if "Sid" in statement: if "Sid" in statement:
assert statement["Sid"] not in sids statementId = statement["Sid"]
sids.append(statement["Sid"]) if statementId:
assert statementId not in sids
sids.append(statementId)
def _validate_statements_syntax(self): def _validate_statements_syntax(self):
assert "Statement" in self._policy_json assert "Statement" in self._policy_json

View File

@ -1827,6 +1827,23 @@ valid_policy_documents = [
"Resource": ["*"] "Resource": ["*"]
} }
] ]
},
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Action": "rds:*",
"Resource": ["arn:aws:rds:region:*:*"]
},
{
"Sid": "",
"Effect": "Allow",
"Action": ["rds:Describe*"],
"Resource": ["*"]
}
]
} }
] ]