Skip to content
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

fix(terraform): Fix two checks and logs #6874

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions checkov/common/graph/graph_builder/graph_components/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ def update_attribute(
try:
self._update_attribute_based_on_jsonpath_key(attribute_value, key)
except Exception as e:
logging.warning(f"Failed updating attribute for key: {key} and value {attribute_value} for"
f"vertex attributes {self.attributes}. Falling back to explicitly setting it."
f"Exception - {e}")
logging.debug(f"Failed updating attribute for key: {key} and value {attribute_value} for"
f"vertex attributes {self.attributes}. Falling back to explicitly setting it."
f"Exception - {e}")
self.attributes[key] = attribute_value
else:
self.attributes[key] = attribute_value
Expand Down
3 changes: 2 additions & 1 deletion checkov/terraform/checks/resource/aws/S3GlobalViewACL.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def scan_resource_conf(self, conf: dict[str, list[Any]]) -> CheckResult:
for policy in conf.get('access_control_policy'):
if 'grant' in policy:
for grant in policy.get('grant'):
if 'permission' in grant and ('FULL_CONTROL' in grant.get('permission') or 'READ_ACP' in grant.get('permission')):
if (isinstance(grant, dict) and 'permission' in grant and
('FULL_CONTROL' in grant.get('permission') or 'READ_ACP' in grant.get('permission'))):
if 'grantee' in grant:
for grantee in grant.get('grantee'):
if 'uri' in grantee and 'http://acs.amazonaws.com/groups/global/AllUsers' in grantee.get('uri'):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def scan_resource_conf(self, conf) -> CheckResult:
if not is_public and access_control_policy:
grants = access_control_policy[0].get('grant', [])
for grant in grants:
if isinstance(grant, str):
continue
grantee = grant.get('grantee', [])
if grantee and grantee[0].get('uri', [None])[0] == 'http://acs.amazonaws.com/groups/global/AllUsers':
# Search for a connected aws_s3_bucket then a connected aws_s3_bucket_public_access_block then
Expand Down
Loading