Skip to content

Commit 3d9be79

Browse files
authored
Update IAM resource ARN patterns (#3389)
* Update IAM resource policy pattern
1 parent 9bd2a20 commit 3d9be79

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

src/cfnlint/data/schemas/other/iam/policy.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
]
1717
},
1818
"AwsArn": {
19-
"pattern": "^(arn:(aws|aws-cn|aws-us-gov):[^:]+:[^:]*:(?:\\d{12}|\\*|aws)?:.+|\\*)$",
19+
"pattern": "(^arn:(aws|aws-cn|aws-us-gov):[^:]+:[^:]*(:(?:\\d{12}|\\*|aws)?:.+|)|\\*)$",
2020
"type": "string"
2121
},
2222
"AwsPrincipalArn": {

test/fixtures/results/quickstart/nist_application.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
},
9090
{
9191
"Filename": "test/fixtures/templates/quickstart/nist_application.yaml",
92-
"Id": "ec06918e-fb60-f3d0-e930-a45d55f4f680",
92+
"Id": "81670f17-4f0b-a2b6-f94e-4385058cb73d",
9393
"Level": "Error",
9494
"Location": {
9595
"End": {
@@ -106,7 +106,7 @@
106106
"LineNumber": 198
107107
}
108108
},
109-
"Message": "{'Ref': 'pSecurityAlarmTopic'} does not match '^(arn:(aws|aws-cn|aws-us-gov):[^:]+:[^:]*:(?:\\\\d{12}|\\\\*|aws)?:.+|\\\\*)$' when 'Ref' is resolved",
109+
"Message": "{'Ref': 'pSecurityAlarmTopic'} does not match '(^arn:(aws|aws-cn|aws-us-gov):[^:]+:[^:]*(:(?:\\\\d{12}|\\\\*|aws)?:.+|)|\\\\*)$' when 'Ref' is resolved",
110110
"ParentId": null,
111111
"Rule": {
112112
"Description": "IAM identity polices are embedded JSON in CloudFormation. This rule validates those embedded policies.",

test/fixtures/results/quickstart/non_strict/nist_application.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
},
9090
{
9191
"Filename": "test/fixtures/templates/quickstart/nist_application.yaml",
92-
"Id": "ec06918e-fb60-f3d0-e930-a45d55f4f680",
92+
"Id": "81670f17-4f0b-a2b6-f94e-4385058cb73d",
9393
"Level": "Error",
9494
"Location": {
9595
"End": {
@@ -106,7 +106,7 @@
106106
"LineNumber": 198
107107
}
108108
},
109-
"Message": "{'Ref': 'pSecurityAlarmTopic'} does not match '^(arn:(aws|aws-cn|aws-us-gov):[^:]+:[^:]*:(?:\\\\d{12}|\\\\*|aws)?:.+|\\\\*)$' when 'Ref' is resolved",
109+
"Message": "{'Ref': 'pSecurityAlarmTopic'} does not match '(^arn:(aws|aws-cn|aws-us-gov):[^:]+:[^:]*(:(?:\\\\d{12}|\\\\*|aws)?:.+|)|\\\\*)$' when 'Ref' is resolved",
110110
"ParentId": null,
111111
"Rule": {
112112
"Description": "IAM identity polices are embedded JSON in CloudFormation. This rule validates those embedded policies.",

test/unit/rules/resources/iam/test_identity_policy.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def test_object_statements(self):
102102
"arn:${AWS::Partition}:iam::123456789012:role/object-role"
103103
]
104104
},
105+
"arn:aws:medialive:*",
105106
],
106107
}
107108
],

0 commit comments

Comments
 (0)