Skip to content

Commit

Permalink
fix(terraform): Fix two checks and logs (#6874)
Browse files Browse the repository at this point in the history
* Fix checks and logs

* Fix flake8
  • Loading branch information
tsmithv11 authored Nov 26, 2024
1 parent 13f5933 commit 4db0683
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
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

0 comments on commit 4db0683

Please sign in to comment.