Description
An effective public-read ACL grants READ to anyone, including anonymous callers. On a bucket this permits listing object names. On an object it permits reading that object’s contents and metadata.
Potential impact
An unintended grant can disclose filenames or files. A bucket with public-read-write also accepts new uploads, which can increase costs. Overwriting or deleting existing objects is subject to ownership restrictions.
Remediation
Check both bucket and object ACLs and policies. Move required access to policies for the accounts and roles that need it, then remove public grants. Where possible, disable ACLs with BucketOwnerEnforced and enable Block Public Access. Test required access and confirm unwanted listing or reads are denied.
Examples
Set bucket_name to an existing ACL-enabled bucket. Block Public Access can reject or ignore public grants. Keep existing protections in place.
Before
- name: Set a bucket ACL
amazon.aws.s3_bucket:
name: "{{ bucket_name }}"
state: present
acl: public-read
public-read affects listing on this bucket. Check object permissions separately to determine who can download files.
After
- name: Set a bucket ACL
amazon.aws.s3_bucket:
name: "{{ bucket_name }}"
state: present
acl: private
private gives only the owner permissions through this bucket ACL. Other policies still apply. If ACLs are disabled, manage access through policies.