in cartography/intel/aws/s3.py [0:0]
def load_s3_details(session, s3_details_iter, aws_account_id, update_tag):
"""
Create dictionaries for all bucket ACLs and all bucket policies so we can import them in a single query for each
"""
acls = []
policies = []
for bucket, acl, policy in s3_details_iter:
if acl is None:
continue
parsed_acls = parse_acl(acl, bucket, aws_account_id)
if parsed_acls:
acls.extend(parsed_acls)
else:
continue
parsed_policy = parse_policy(bucket, policy)
if parsed_policy is not None:
policies.append(parsed_policy)
# cleanup existing policy properties set on S3 Buckets
run_cleanup_job(
'aws_s3_details.json',
session,
{'UPDATE_TAG': update_tag, 'AWS_ID': aws_account_id}
)
_load_s3_acls(session, acls, aws_account_id, update_tag)
_load_s3_policies(session, policies, update_tag)
_set_default_values(session, aws_account_id)