Skip to content

Commit

Permalink
feat(aws): resolve error
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoPBrito committed Aug 7, 2024
1 parent b935328 commit d7fd3e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from prowler.lib.check.models import Check, Check_Report_AWS
from prowler.providers.aws.services.s3.s3_client import s3_client
from prowler.providers.aws.services.s3.s3control_client import s3control_client


Expand All @@ -11,7 +12,7 @@ def execute(self):
report.resource_id = access_point.name
report.resource_arn = arn
report.status = "PASS"
report.status_extended = f"Access Point {access_point.name} of bucket {access_point.bucket} does have Public Access Block enabled."
report.status_extended = f"Access Point {access_point.name} of bucket {access_point.bucket} in account {s3_client.audited_account} does have Public Access Block enabled."

if not (
access_point.public_access_block.block_public_acls
Expand All @@ -20,7 +21,7 @@ def execute(self):
and access_point.public_access_block.restrict_public_buckets
):
report.status = "FAIL"
report.status_extended = f"Access Point {access_point.name} of bucket {access_point.bucket} does not have Public Access Block enabled."
report.status_extended = f"Access Point {access_point.name} of bucket {access_point.bucket} in account {s3_client.audited_account} does not have Public Access Block enabled."

findings.append(report)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def test_access_points_with_public_access_block(self):
assert result[0].status == "PASS"
assert (
result[0].status_extended
== f"Access Point {ap_name_us} of bucket {bucket_name_us} does have Public Access Block enabled."
== f"Access Point {ap_name_us} of bucket {bucket_name_us} in account {AWS_ACCOUNT_NUMBER} does have Public Access Block enabled."
)
assert result[0].resource_id == ap_name_us
assert (
Expand All @@ -133,7 +133,7 @@ def test_access_points_with_public_access_block(self):
assert result[1].status == "PASS"
assert (
result[1].status_extended
== f"Access Point {ap_name_eu} of bucket {bucket_name_eu} does have Public Access Block enabled."
== f"Access Point {ap_name_eu} of bucket {bucket_name_eu} in account {AWS_ACCOUNT_NUMBER} does have Public Access Block enabled."
)
assert result[1].resource_id == ap_name_eu
assert (
Expand Down Expand Up @@ -214,7 +214,7 @@ def test_access_points_without_public_access_block(self):
assert result[0].status == "FAIL"
assert (
result[0].status_extended
== f"Access Point {ap_name_us} of bucket {bucket_name_us} does not have Public Access Block enabled."
== f"Access Point {ap_name_us} of bucket {bucket_name_us} in account {AWS_ACCOUNT_NUMBER} does not have Public Access Block enabled."
)
assert result[0].resource_id == ap_name_us
assert (
Expand All @@ -227,7 +227,7 @@ def test_access_points_without_public_access_block(self):
assert result[1].status == "FAIL"
assert (
result[1].status_extended
== f"Access Point {ap_name_eu} of bucket {bucket_name_eu} does not have Public Access Block enabled."
== f"Access Point {ap_name_eu} of bucket {bucket_name_eu} in account {AWS_ACCOUNT_NUMBER} does not have Public Access Block enabled."
)
assert result[1].resource_id == ap_name_eu
assert (
Expand Down Expand Up @@ -308,7 +308,7 @@ def test_access_points_without_one_public_access_block(self):
assert result[0].status == "PASS"
assert (
result[0].status_extended
== f"Access Point {ap_name_us} of bucket {bucket_name_us} does have Public Access Block enabled."
== f"Access Point {ap_name_us} of bucket {bucket_name_us} in account {AWS_ACCOUNT_NUMBER} does have Public Access Block enabled."
)
assert result[0].resource_id == ap_name_us
assert (
Expand All @@ -321,7 +321,7 @@ def test_access_points_without_one_public_access_block(self):
assert result[1].status == "FAIL"
assert (
result[1].status_extended
== f"Access Point {ap_name_eu} of bucket {bucket_name_eu} does not have Public Access Block enabled."
== f"Access Point {ap_name_eu} of bucket {bucket_name_eu} in account {AWS_ACCOUNT_NUMBER} does not have Public Access Block enabled."
)
assert result[1].resource_id == ap_name_eu
assert (
Expand Down

0 comments on commit d7fd3e4

Please sign in to comment.