Review S3 public ACL suppression

Check protection that prevents public ACL grants from authorizing access.

Description

ignore_public_acls = true makes S3 disregard public grants in bucket and object ACLs, including grants already stored. It leaves the ACLs in place.

Potential impact

If those grants are effective, an unintended reader may be able to list objects or read their contents.

Remediation

Enable ignore_public_acls and keep block_public_acls enabled to reject new public ACLs. Remove unnecessary public grants and review the bucket policy separately. If ACLs are no longer needed, move required permissions to policies and disable ACLs through Object Ownership.

Examples

Replace example with your bucket name. New buckets disable ACLs by default. Terraform defaults the omitted restrict_public_buckets to false. Set it explicitly if the bucket needs that protection. Check account settings and Object Ownership for any other restrictions.

Before

hcl
resource "aws_s3_bucket" "example" {
  bucket = "example"
}

resource "aws_s3_bucket_public_access_block" "example" {
  bucket = aws_s3_bucket.example.id

  block_public_acls   = true
  block_public_policy = true
  ignore_public_acls  = false
}

After

hcl
resource "aws_s3_bucket" "example" {
  bucket = "example"
}

resource "aws_s3_bucket_public_access_block" "example" {
  bucket = aws_s3_bucket.example.id

  block_public_acls   = true
  block_public_policy = true
  ignore_public_acls  = true
}

Both examples block new public ACL requests. Only the second tells S3 to ignore existing public ACL grants.

References