Skip to content

Commit

Permalink
Update IAM resource ARN patterns (#3389)
Browse files Browse the repository at this point in the history
* Update IAM resource policy pattern
  • Loading branch information
kddejong authored Jun 24, 2024
1 parent 9bd2a20 commit 3d9be79
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/cfnlint/data/schemas/other/iam/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
]
},
"AwsArn": {
"pattern": "^(arn:(aws|aws-cn|aws-us-gov):[^:]+:[^:]*:(?:\\d{12}|\\*|aws)?:.+|\\*)$",
"pattern": "(^arn:(aws|aws-cn|aws-us-gov):[^:]+:[^:]*(:(?:\\d{12}|\\*|aws)?:.+|)|\\*)$",
"type": "string"
},
"AwsPrincipalArn": {
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/results/quickstart/nist_application.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
},
{
"Filename": "test/fixtures/templates/quickstart/nist_application.yaml",
"Id": "ec06918e-fb60-f3d0-e930-a45d55f4f680",
"Id": "81670f17-4f0b-a2b6-f94e-4385058cb73d",
"Level": "Error",
"Location": {
"End": {
Expand All @@ -106,7 +106,7 @@
"LineNumber": 198
}
},
"Message": "{'Ref': 'pSecurityAlarmTopic'} does not match '^(arn:(aws|aws-cn|aws-us-gov):[^:]+:[^:]*:(?:\\\\d{12}|\\\\*|aws)?:.+|\\\\*)$' when 'Ref' is resolved",
"Message": "{'Ref': 'pSecurityAlarmTopic'} does not match '(^arn:(aws|aws-cn|aws-us-gov):[^:]+:[^:]*(:(?:\\\\d{12}|\\\\*|aws)?:.+|)|\\\\*)$' when 'Ref' is resolved",
"ParentId": null,
"Rule": {
"Description": "IAM identity polices are embedded JSON in CloudFormation. This rule validates those embedded policies.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
},
{
"Filename": "test/fixtures/templates/quickstart/nist_application.yaml",
"Id": "ec06918e-fb60-f3d0-e930-a45d55f4f680",
"Id": "81670f17-4f0b-a2b6-f94e-4385058cb73d",
"Level": "Error",
"Location": {
"End": {
Expand All @@ -106,7 +106,7 @@
"LineNumber": 198
}
},
"Message": "{'Ref': 'pSecurityAlarmTopic'} does not match '^(arn:(aws|aws-cn|aws-us-gov):[^:]+:[^:]*:(?:\\\\d{12}|\\\\*|aws)?:.+|\\\\*)$' when 'Ref' is resolved",
"Message": "{'Ref': 'pSecurityAlarmTopic'} does not match '(^arn:(aws|aws-cn|aws-us-gov):[^:]+:[^:]*(:(?:\\\\d{12}|\\\\*|aws)?:.+|)|\\\\*)$' when 'Ref' is resolved",
"ParentId": null,
"Rule": {
"Description": "IAM identity polices are embedded JSON in CloudFormation. This rule validates those embedded policies.",
Expand Down
1 change: 1 addition & 0 deletions test/unit/rules/resources/iam/test_identity_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def test_object_statements(self):
"arn:${AWS::Partition}:iam::123456789012:role/object-role"
]
},
"arn:aws:medialive:*",
],
}
],
Expand Down

0 comments on commit 3d9be79

Please sign in to comment.