Description
A deletion grant with Principal: "*" can apply to callers outside the operations team. The action, resource, conditions, explicit denies and Block Public Access determine its scope. Object deletion and removal of bucket settings are separate permissions.
Potential impact
Losing data or settings can disrupt a service. Missing logs or backups can hinder investigation and recovery. In a versioning-enabled bucket, deleting an object without a version ID normally adds a delete marker. Permanently removing a version requires s3:DeleteObjectVersion.
Remediation
- Remove unnecessary deletion grants. Name the roles or accounts responsible for cleanup, and limit each grant to the valid actions and bucket or object ARNs it needs.
- Check conditions, other allows and denies, and Block Public Access. Configure versioning and backups for your recovery needs, then test recovery.
Examples
The excerpts omit the bucket definition referenced by DOC-EXAMPLE-BUCKET. A deployable policy also needs the correct bucket or object ARNs for its actions.
Incomplete deletion grant
Resources:
SampleBucketPolicy3:
Type: "AWS::S3::BucketPolicy"
Properties:
Bucket: !Ref DOC-EXAMPLE-BUCKET
PolicyDocument:
Statement:
- Action: "DeleteObject"
Effect: Allow
Resource: "*"
Principal: "*"
DeleteObject is missing the required s3: prefix. Restrict any deletion grant to the required principals and resources.
Explicit denial of object deletion
Resources:
SampleBucketPolicy1:
Type: "AWS::S3::BucketPolicy"
Properties:
Bucket: !Ref DOC-EXAMPLE-BUCKET
PolicyDocument:
Statement:
- Action:
- "s3:DeleteObject"
Effect: Deny
Resource: "*"
Principal: "*"
In a valid policy, this deny can block legitimate s3:DeleteObject requests for every principal. It leaves actions such as s3:DeleteObjectVersion outside its scope. Check required cleanup and recovery before applying it.