You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Parses IAM identity-based and resource-based policies from AWS CloudFormation templates and evaluated CloudFormation intrinsic functions and pseudo parameters. Then runs the policies through IAM Access Analyzer for a custom check against a list of IAM actions. Returns the findings from the custom check in JSON format. Exits with a non-zero error code if any findings categorized as blocking, based on access granted to at least one of the listed IAM actions, are found in your template. Exits with an error code of zero if all findings are non-blocking or there are no findings.
118
+
Parses IAM identity-based and resource-based policies from AWS CloudFormation templates. Then runs the policies through IAM Access Analyzer for a custom check against a list of IAM actions and/or resource ARNs. If both actions and resources are provided, a custom check will be run to determine whether access is granted to allow the specified actions on the specified resources. Returns the findings from the custom check in JSON format. Exits with a non-zero error code if any findings categorized as blocking, based on access granted to at least one of the listed IAM actions and/or resources, are found in your template. Exits with an error code of zero if all findings are non-blocking or there are no findings.
119
119
120
120
| Arguments | Required | Options | Description |
121
121
| --------- | -------- | ---------| ----------- |
@@ -127,6 +127,27 @@ Parses IAM identity-based and resource-based policies from AWS CloudFormation te
127
127
| --enable-logging ||| Enables log output to stdout |
128
128
| --ignore-finding | | FINDING_CODE,RESOURCE_NAME,RESOURCE_NAME.FINDING_CODE | Allow validation failures to be ignored. Specify as a comma separated list of findings to be ignored. Can be individual finding codes (e.g. "PASS_ROLE_WITH_STAR_IN_RESOURCE"), a specific resource name (e.g. "MyResource"), or a combination of both separated by a period.(e.g. "MyResource.PASS_ROLE_WITH_STAR_IN_RESOURCE"). Names of finding codes may change in IAM Access Analyzer over time.
129
129
| --actions | Yes | ACTION,ACTION,ACTION | List of comma-separated actions. |
130
+
| -- resources | At least one of actions or resources is required. | RESOURCE,RESOURCE,RESOURCE | List of comma-separated resource ARNs, maximum 100 resources ARNs. |
131
+
| --treat-findings-as-non-blocking ||| When not specified, the tool detects any findings, it will exit with a non-zero exit code. When specified, the tool exits with an exit code of 0. |
132
+
| --allow-dynamic-ref-without-version ||| Override the default behavior and allow dynamic SSM references without version numbers. The version number ensures that the SSM parameter value that was validated is the one that is deployed. |
133
+
| --exclude-resource-types || AWS::SERVICE::RESOURCE, AWS::SERVICE::RESOURCE | List of comma-separated resource types. Resource types should be the same as Cloudformation template resource names such as AWS::IAM::Role, AWS::S3::Bucket |
Parses resource-based policies from AWS CloudFormation templates. Then runs the policies through IAM Access Analyzer for a custom check for public access to resources. Returns the findings from the custom check in JSON format. Exits with a non-zero error code if any findings categorized as blocking, based on whether public access is granted to at least one of the resources, are found in your template. Exits with an error code of zero if all findings are non-blocking or there are no findings.
141
+
142
+
| Arguments | Required | Options | Description |
143
+
| --------- | -------- | ---------| ----------- |
144
+
| --template-path | Yes | FILE_NAME | The path to the CloudFormation template. |
145
+
| --region | Yes | REGION | The destination region the resources will be deployed to. |
146
+
| --parameters || KEY=VALUE [KEY=VALUE ...]| Keys and values for CloudFormation template parameters. Only parameters that are referenced by IAM policies in the template are required. |
147
+
| --template-configuration-file | | FILE_PATH.json | A JSON formatted file that specifies template parameter values, a stack policy, and tags. Only parameters are used from this file. Everything else is ignored. Identical values passed in the --parameters flag override parameters in this file. See CloudFormation documentation for file format: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/continuous-delivery-codepipeline-cfn-artifacts.html#w2ab1c21c15c15
148
+
| --profile || PROFILE | The named profile to use for AWS API calls. |
149
+
| --enable-logging ||| Enables log output to stdout |
150
+
| --ignore-finding | | FINDING_CODE,RESOURCE_NAME,RESOURCE_NAME.FINDING_CODE | Allow validation failures to be ignored. Specify as a comma separated list of findings to be ignored. Can be individual finding codes (e.g. "PASS_ROLE_WITH_STAR_IN_RESOURCE"), a specific resource name (e.g. "MyResource"), or a combination of both separated by a period.(e.g. "MyResource.PASS_ROLE_WITH_STAR_IN_RESOURCE"). Names of finding codes may change in IAM Access Analyzer over time.
130
151
| --treat-findings-as-non-blocking ||| When not specified, the tool detects any findings, it will exit with a non-zero exit code. When specified, the tool exits with an exit code of 0. |
131
152
| --allow-dynamic-ref-without-version ||| Override the default behavior and allow dynamic SSM references without version numbers. The version number ensures that the SSM parameter value that was validated is the one that is deployed. |
132
153
| --exclude-resource-types || AWS::SERVICE::RESOURCE, AWS::SERVICE::RESOURCE | List of comma-separated resource types. Resource types should be the same as Cloudformation template resource names such as AWS::IAM::Role, AWS::S3::Bucket |
@@ -152,18 +173,18 @@ Parses IAM identity-based and resource-based policies from AWS CloudFormation te
152
173
153
174
### Supported resource-based policies
154
175
155
-
| CloudFormation Resource Type | Policy best practice checks | Access previews (check for external access) |
### Intrinsic function and Pseudo parameter support
169
190
@@ -236,6 +257,7 @@ The principal used to execute the cfn-policy-validator requires the following pe
236
257
"access-analyzer:CreateAnalyzer",
237
258
"access-analyzer:CheckNoNewAccess",
238
259
"access-analyzer:CheckAccessNotGranted",
260
+
"access-analyzer:CheckNoPublicAccess",
239
261
"s3:ListAllMyBuckets",
240
262
"cloudformation:ListExports",
241
263
"ssm:GetParameter"
@@ -268,6 +290,7 @@ The principal used to execute the cfn-policy-validator requires the following pe
268
290
| access-analyzer:CreateAnalyzer| (Optional) Create an analyzer if one does not already exist in the account. Optional if account has analyzer already. |
269
291
| access-analyzer:CheckNoNewAccess| Called for each policy to validate against a reference policy to compare permissions. |
270
292
| access-analyzer:CheckAccessNotGranted| Called for each policy to validate that it does not grant access to a list of IAM actions, considered as critical permissions, provided as input. |
293
+
| access-analyzer:CheckNoPublicAccess| Called for each policy to validate that it does not grant public access to supported resource types. |
271
294
| iam:CreateServiceLinkedRole| (Optional) Create a service linked role if an analyzer must be created in account. Optional if account has analyzer already. |
272
295
| s3:ListAllMyBuckets| Retrieve the canonical ID of the account. |
273
296
| cloudformation:ListExports| List CloudFormation exports to be used with Fn::ImportValue |
@@ -295,6 +318,10 @@ Access previews take in the entire context of your AWS account, not just the S3
295
318
296
319
Creating an access preview for a SecretsManager Secret requires a KMSKeyId. The cfn-policy-validator does not yet support parsing the KMS Key from the environment. When no KMSKeyId is supplied, the CreateAccessPreview API uses the default CMK in the account which is not externally accessible.
297
320
321
+
### What is the distinction between Access Previews and CheckNoPublicAccess?
322
+
323
+
CheckNoPublicAccess custom policy checks differ from Access Previews because CheckNoPublicAccess checks do not require any account or external access analyzer context. Note that a charge is associated with each custom policy check.
check_access_parser=subparsers.add_parser('check-access-not-granted', help='Parses IAM identity-based and resource-based policies from AWS CloudFormation templates '
188
-
'and runs them through IAM Access Analyzer to check that access to a list of actions is not granted. Returns the response '
189
-
'in JSON format.', parents=[parent_parser])
199
+
check_access_parser=subparsers.add_parser('check-access-not-granted', help='Parses IAM identity-based and resource-based policies from'
200
+
'AWS CloudFormation templates and runs them through IAM Access Analyzer to check '
201
+
'that access to a list of actions and/or resources is not granted. Returns the '
202
+
'response in JSON format.', parents=[parent_parser])
0 commit comments