Skip to content

Commit

Permalink
fix(report): remove invalid resources in report (#6852)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCloudSec authored Feb 19, 2025
1 parent f3abcc9 commit b861d97
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def execute(self) -> Check_Report_AWS:
):
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def test_contacts_not_configured_or_equal(self):
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])
Expand Down Expand Up @@ -109,6 +110,7 @@ def test_contacts_different(self):
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])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def test__root_credentials_management_enabled(self):
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
Expand Down Expand Up @@ -154,3 +155,4 @@ def test__root_credentials_management_disabled(self):
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 == {}

0 comments on commit b861d97

Please sign in to comment.