AWS S3
storage.s3
Protects against destructive S3 operations like bucket removal, recursive deletes, and sync --delete.
- 6blocking rules
- 10safe patterns
- 2Critical
- 3High
- 1Medium
[packs]
enabled = ["storage.s3"]Evaluated when a command contains s3, s3api, rb, delete-bucket, delete-object, delete-objects, --delete.
Blocking rules
Each rule ID is storage.s3:<name>. Use it in allowlists and [policy.rules].
Criticals3-rbaws s3 rb removes an S3 bucket and is destructive.
Explanation
Removing an S3 bucket deletes the bucket and optionally all objects within it (with --force). Bucket names are globally unique and may be claimed by others after deletion. Versioned objects require additional cleanup. Safer alternatives: - aws s3 ls: Review bucket contents first - Empty the bucket before removal - Enable bucket versioning for recovery options
Criticals3api-delete-bucketaws s3api delete-bucket permanently deletes a bucket.
Explanation
The delete-bucket API removes an S3 bucket. The bucket must be empty (including all versions and delete markers). Once deleted, the bucket name becomes available globally and may be claimed by others. Safer alternatives: - aws s3api list-objects-v2: Verify bucket is empty - aws s3api list-object-versions: Check for versions - Use lifecycle policies for managed cleanup
Highs3-rmaws s3 rm deletes S3 objects and is destructive.
Explanation
The rm command deletes objects from S3. With --recursive, it deletes all objects under a prefix. For versioned buckets, this creates delete markers; for unversioned buckets, data is permanently lost. Safer alternatives: - aws s3 ls: Review objects before deletion - Use --dryrun to preview what will be deleted - Enable versioning for recovery options
Highs3-sync-deleteaws s3 sync --delete removes destination objects not in source.
Explanation
The --delete flag removes files from the destination that don't exist in the source. This can accidentally delete important data if source and destination are swapped or if source is empty. Safer alternatives: - aws s3 sync --dryrun: Preview changes first - Omit --delete for additive-only sync - Back up destination before syncing
Highs3api-delete-objectsaws s3api delete-objects permanently deletes multiple objects.
Explanation
Batch deletion removes up to 1,000 objects per request. A malformed delete JSON file can remove unintended objects. Deletions are processed in parallel and cannot be easily stopped once started. Safer alternatives: - Review the delete JSON file carefully - Test with a single object first - Enable versioning before bulk deletions
Mediums3api-delete-objectaws s3api delete-object permanently deletes an object.
Explanation
Deleting an object removes it from S3. For versioned buckets, this creates a delete marker. Specifying a version-id permanently deletes that specific version. Unversioned objects are immediately and permanently deleted. Safer alternatives: - aws s3api head-object: Verify object exists - Use bucket versioning for recovery - Copy to backup location before deletion
Safe patterns
Checked first. A command that matches one is never blocked by this pack.
s3-lists3-copys3-presigns3-mbs3-rm-dryruns3-sync-delete-dryruns3-sync-dryrun-deletes3api-list-objectss3api-get-objects3api-head-object