fix(report): remove invalid resources in report (#6852)

This commit is contained in:
Sergio Garcia
2025-02-19 16:42:52 +01:00
committed by GitHub
parent f3abcc9dd6
commit b861d97ad4
7 changed files with 9 additions and 13 deletions
@@ -6,9 +6,7 @@ from prowler.providers.aws.services.account.account_client import account_client
class account_maintain_current_contact_details(Check):
def execute(self):
report = Check_Report_AWS(
metadata=self.metadata(), resource=account_client.contact_base
)
report = Check_Report_AWS(metadata=self.metadata(), resource={})
report.region = account_client.region
report.resource_id = account_client.audited_account
report.resource_arn = account_client.audited_account_arn
@@ -8,9 +8,7 @@ class account_maintain_different_contact_details_to_security_billing_and_operati
def execute(self):
findings = []
if account_client.contact_base:
report = Check_Report_AWS(
metadata=self.metadata(), resource=account_client.contact_base
)
report = Check_Report_AWS(metadata=self.metadata(), resource={})
report.resource_id = account_client.audited_account
report.resource_arn = account_client.audited_account_arn
report.region = account_client.region
@@ -6,9 +6,7 @@ from prowler.providers.aws.services.account.account_client import account_client
class account_security_contact_information_is_registered(Check):
def execute(self):
report = Check_Report_AWS(
metadata=self.metadata(), resource=account_client.contact_base
)
report = Check_Report_AWS(metadata=self.metadata(), resource={})
report.region = account_client.region
report.resource_id = account_client.audited_account
report.resource_arn = account_client.audited_account_arn
@@ -6,9 +6,7 @@ from prowler.providers.aws.services.account.account_client import account_client
class account_security_questions_are_registered_in_the_aws_account(Check):
def execute(self):
report = Check_Report_AWS(
metadata=self.metadata(), resource=account_client.contacts_security
)
report = Check_Report_AWS(metadata=self.metadata(), resource={})
report.region = account_client.region
report.resource_id = account_client.audited_account
report.resource_arn = account_client.audited_account_arn
@@ -15,7 +15,7 @@ class iam_root_credentials_management_enabled(Check):
):
report = Check_Report_AWS(
metadata=self.metadata(),
resource=iam_client.organization_features,
resource={},
)
report.region = iam_client.region
report.resource_arn = iam_client.audited_account_arn
@@ -56,6 +56,7 @@ class Test_account_maintain_different_contact_details_to_security_billing_and_op
assert result[0].region == AWS_REGION_EU_WEST_1
assert result[0].resource_id == AWS_ACCOUNT_NUMBER
assert result[0].resource_arn == AWS_ACCOUNT_ARN
assert result[0].resource == {}
def test_contacts_different(self):
aws_mocked_provider = set_mocked_aws_provider([AWS_REGION_EU_WEST_1])
@@ -109,6 +110,7 @@ class Test_account_maintain_different_contact_details_to_security_billing_and_op
assert result[0].region == AWS_REGION_EU_WEST_1
assert result[0].resource_id == AWS_ACCOUNT_NUMBER
assert result[0].resource_arn == AWS_ACCOUNT_ARN
assert result[0].resource == {}
def test_access_denied(self):
aws_mocked_provider = set_mocked_aws_provider([AWS_REGION_EU_WEST_1])
@@ -110,6 +110,7 @@ class Test_iam_root_credentials_management_enabled_test:
assert result[0].resource_id == AWS_ACCOUNT_NUMBER
assert result[0].resource_arn == AWS_ACCOUNT_ARN
assert result[0].region == AWS_REGION_US_EAST_1
assert result[0].resource == {}
@mock.patch(
"botocore.client.BaseClient._make_api_call", new=mock_make_api_call_disabled
@@ -154,3 +155,4 @@ class Test_iam_root_credentials_management_enabled_test:
assert result[0].resource_id == AWS_ACCOUNT_NUMBER
assert result[0].resource_arn == AWS_ACCOUNT_ARN
assert result[0].region == AWS_REGION_US_EAST_1
assert result[0].resource == {}