fix(organizations): no finding for access denied in listing policies (#5400)

This commit is contained in:
Sergio Garcia
2024-10-14 13:58:30 -04:00
committed by GitHub
parent 808fa96407
commit 434460b978
2 changed files with 25 additions and 25 deletions
@@ -9,17 +9,17 @@ class organizations_opt_out_ai_services_policy(Check):
findings = []
for org in organizations_client.organizations:
report = Check_Report_AWS(self.metadata())
report.resource_id = org.id
report.resource_arn = org.arn
report.region = organizations_client.region
report.status = "FAIL"
report.status_extended = (
"AWS Organizations is not in-use for this AWS Account."
)
if org.status == "ACTIVE":
report.status_extended = f"AWS Organization {org.id} has not opted out of all AI services, granting consent for AWS to access its data."
if org.policies is not None: # Access Denied to list_policies
if org.policies is not None: # Access Denied to list_policies
report = Check_Report_AWS(self.metadata())
report.resource_id = org.id
report.resource_arn = org.arn
report.region = organizations_client.region
report.status = "FAIL"
report.status_extended = (
"AWS Organizations is not in-use for this AWS Account."
)
if org.status == "ACTIVE":
report.status_extended = f"AWS Organization {org.id} has not opted out of all AI services, granting consent for AWS to access its data."
for policy in org.policies.get("AISERVICES_OPT_OUT_POLICY", []):
if (
policy.content.get("services", {})
@@ -32,6 +32,6 @@ class organizations_opt_out_ai_services_policy(Check):
report.status_extended = f"AWS Organization {org.id} has opted out of all AI services, not granting consent for AWS to access its data."
break
findings.append(report)
findings.append(report)
return findings
@@ -9,26 +9,26 @@ class organizations_tags_policies_enabled_and_attached(Check):
findings = []
for org in organizations_client.organizations:
report = Check_Report_AWS(self.metadata())
report.resource_id = org.id
report.resource_arn = org.arn
report.region = organizations_client.region
report.status = "FAIL"
report.status_extended = (
"AWS Organizations is not in-use for this AWS Account."
)
if org.status == "ACTIVE":
if org.policies is not None: # Access Denied to list_policies
report = Check_Report_AWS(self.metadata())
report.resource_id = org.id
report.resource_arn = org.arn
report.region = organizations_client.region
report.status = "FAIL"
report.status_extended = (
f"AWS Organizations {org.id} does not have tag policies."
"AWS Organizations is not in-use for this AWS Account."
)
if org.policies is not None: # Access Denied to list_policies
if org.status == "ACTIVE":
report.status_extended = (
f"AWS Organizations {org.id} does not have tag policies."
)
for policy in org.policies.get("TAG_POLICY", []):
report.status_extended = f"AWS Organization {org.id} has tag policies enabled but not attached."
if policy.targets:
report.status = "PASS"
report.status_extended = f"AWS Organization {org.id} has tag policies enabled and attached to an AWS account."
findings.append(report)
findings.append(report)
return findings