Description
BlockPublicPolicy rejects a new or updated bucket policy that S3 classifies as public. Existing policies stay in place. New buckets enable Block Public Access by default, so check the deployed bucket and account settings if the template omits them.
Potential impact
A later policy change could expose objects if it grants public access and no other control blocks it.
Remediation
Enable all four Block Public Access options on private buckets and remove unnecessary public grants from policies and ACLs. If a service needs public access, review whether a private bucket can serve it first. Limit any public grant to the actions and objects it needs. Test required service and cross-account access.
Examples
Before
Resources:
Bucket13:
Type: AWS::S3::Bucket
Properties:
PublicAccessBlockConfiguration:
BlockPublicAcls: false
BlockPublicPolicy: false
IgnorePublicAcls: false
RestrictPublicBuckets: true
The first template still limits access through public policies with RestrictPublicBuckets. A stricter account setting can also reject new public policies.
After
Resources:
Bucket13:
Type: AWS::S3::Bucket
Properties:
PublicAccessBlockConfiguration:
BlockPublicAcls: true
BlockPublicPolicy: true
IgnorePublicAcls: true
RestrictPublicBuckets: true
The second template enables all four options. Neither template grants access by itself.