mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 06:45:08 +00:00
fix(s3_bucket_policy_public_write_access): look at account and bucket-level public access block settings (#2715)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
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
|
||||
|
||||
|
||||
class s3_bucket_policy_public_write_access(Check):
|
||||
@@ -17,6 +18,22 @@ class s3_bucket_policy_public_write_access(Check):
|
||||
report.status_extended = (
|
||||
f"S3 Bucket {bucket.name} does not have a bucket policy."
|
||||
)
|
||||
elif (
|
||||
s3control_client.account_public_access_block
|
||||
and s3control_client.account_public_access_block.restrict_public_buckets
|
||||
):
|
||||
report.status = "PASS"
|
||||
report.status_extended = (
|
||||
"All S3 public access blocked at account level."
|
||||
)
|
||||
elif (
|
||||
bucket.public_access_block
|
||||
and bucket.public_access_block.restrict_public_buckets
|
||||
):
|
||||
report.status = "PASS"
|
||||
report.status_extended = (
|
||||
f"S3 public access blocked at bucket level for {bucket.name}."
|
||||
)
|
||||
else:
|
||||
report.status = "PASS"
|
||||
report.status_extended = f"S3 Bucket {bucket.name} does not allow public write access in the bucket policy."
|
||||
|
||||
Reference in New Issue
Block a user