Merge pull request #2415 from brunog3/fix-iam-policy-statements-with-empty-sid

Fix multiple IAM Policy Statement creation with empty sid
This commit is contained in:
Steve Pulec 2019-09-11 22:04:35 -05:00 committed by GitHub
commit e5311eb6f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 2 deletions

View File

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

View File

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