-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(terraform): 7 new policies #7056
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Left some comments. Also:
- Please add in the description the CKV ID to Prisma Cloud ID mapping
- Make sure the tests pass
- Add evaluated_keys or get_evaluated_keys
checkov/terraform/checks/resource/aws/AutoScalingGroupWithPublicAccess.py
Outdated
Show resolved
Hide resolved
def scan_resource_conf(self, conf): | ||
if 'block_public_access' in conf: | ||
for arg in list(conf['block_public_access'][0].keys()): | ||
if arg in ['block_public_acls', 'ignore_public_acls', 'restrict_public_buckets']: | ||
if str(conf['block_public_access'][0][arg][0]).lower() == 'false': | ||
return CheckResult.FAILED | ||
return CheckResult.PASSED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These attributes don't exist. You want to check if block_public_security_group_rules
is true (BaseResourceValueCheck)
checkov/terraform/checks/resource/aws/RedshiftClusterWithCommonUsernameAndPublicAccess.py
Outdated
Show resolved
Hide resolved
if 'publicly_accessible' in conf: | ||
if str(conf['publicly_accessible'][0]).lower() == 'true': | ||
return CheckResult.FAILED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default publicly_accessible is true, so also check for the absence of the attribute
def scan_resource_conf(self, conf): | ||
if 'acl' in conf: | ||
if conf['acl'][0] == 'public-read': | ||
return CheckResult.FAILED | ||
return CheckResult.PASSED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is like CKV_AWS_20 but less complete and different than what 630d3779-d932-4fbf-9cce-6e8d793c6916
is looking for
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean, do you think that this is more accurate? (setting block_public_policy
to false
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to check that the S3 has the pbulic access block, and check if there is a aws_s3_account_public_access_block and check if there is a aws_s3_bucket_website_configuration attached. It would look closer to this: https://github.com/bridgecrewio/checkov/blob/66988745cf9b93c449e3693219c5679e3be19a32/checkov/terraform/checks/resource/aws/S3SecureDataTransport.py
checkov/terraform/checks/resource/aws/S3BucketPubliclyReadableViaACL.py
Outdated
Show resolved
Hide resolved
checkov/terraform/checks/resource/aws/UnpatchedAuroraPostgresDB.py
Outdated
Show resolved
Hide resolved
checkov/terraform/checks/resource/aws/WAFv2VulnerableForLog4j.py
Outdated
Show resolved
Hide resolved
checkov/terraform/checks/resource/aws/WAFv2VulnerableForLog4j.py
Outdated
Show resolved
Hide resolved
…icAccess.py Co-authored-by: Taylor <[email protected]>
Co-authored-by: Taylor <[email protected]>
…nUsernameAndPublicAccess.py Co-authored-by: Taylor <[email protected]>
…ViaACL.py Co-authored-by: Taylor <[email protected]>
…B.py Co-authored-by: Taylor <[email protected]>
Co-authored-by: Taylor <[email protected]>
…essible.py Co-authored-by: Taylor <[email protected]>
…from-CSPM' into feat(terraform)-medium-policies-from-CSPM
…from-CSPM' into feat(terraform)-medium-policies-from-CSPM # Conflicts: # checkov/terraform/checks/resource/aws/EMRPubliclyAccessible.py # checkov/terraform/checks/resource/aws/RedshiftClusterWithCommonUsernameAndPublicAccess.py # checkov/terraform/checks/resource/aws/S3BucketPubliclyReadableViaACL.py # checkov/terraform/checks/resource/aws/WAFv2VulnerableForLog4j.py
…from-CSPM' into feat(terraform)-medium-policies-from-CSPM
User description
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes # (issue)
New/Edited policies (Delete if not relevant)
Description
Include a description of what makes it a violation and any relevant external links.
Fix
How does someone fix the issue in code and/or in runtime?
Checklist:
Generated description
Below is a concise technical summary of the changes proposed in this PR:
Modified files (7)
Latest Contributors(0)
Modified files (7)
Latest Contributors(0)
Modified files (1)
Latest Contributors(0)
Modified files (7)
Latest Contributors(0)