2024-04-11 14:23:07 +00:00
|
|
|
id: s3-versioning
|
|
|
|
info:
|
|
|
|
name: S3 Bucket Versioning not Enabled
|
|
|
|
author: princechaddha
|
|
|
|
severity: low
|
|
|
|
description: |
|
|
|
|
Verifies that Amazon S3 buckets have object versioning enabled, providing a safeguard for recovering overwritten or deleted objects
|
|
|
|
reference:
|
|
|
|
- https://docs.aws.amazon.com/AmazonS3/latest/userguide/manage-versioning-examples.html
|
2024-06-07 10:04:29 +00:00
|
|
|
metadata:
|
|
|
|
max-request: 2
|
2024-04-11 14:23:07 +00:00
|
|
|
tags: cloud,devops,aws,amazon,s3,aws-cloud-config
|
|
|
|
|
|
|
|
flow: |
|
|
|
|
code(1)
|
|
|
|
for(let bucketName of iterate(template.buckets)){
|
|
|
|
set("bucket", bucketName)
|
|
|
|
code(2)
|
|
|
|
}
|
|
|
|
|
|
|
|
self-contained: true
|
|
|
|
code:
|
|
|
|
- engine:
|
|
|
|
- sh
|
|
|
|
- bash
|
|
|
|
source: |
|
|
|
|
aws s3api list-buckets --query 'Buckets[*].Name'
|
|
|
|
|
|
|
|
extractors:
|
|
|
|
- type: json # type of the extractor
|
|
|
|
internal: true
|
|
|
|
name: buckets
|
|
|
|
json:
|
|
|
|
- '.[]'
|
|
|
|
|
|
|
|
- engine:
|
|
|
|
- sh
|
|
|
|
- bash
|
|
|
|
source: |
|
|
|
|
aws s3api get-bucket-versioning --bucket $bucket --query 'Status'
|
|
|
|
|
|
|
|
matchers:
|
|
|
|
- type: word
|
|
|
|
words:
|
|
|
|
- "null"
|
|
|
|
- "Suspended"
|
|
|
|
|
|
|
|
extractors:
|
|
|
|
- type: dsl
|
|
|
|
dsl:
|
|
|
|
- '"Versioning is not enabled for S3 Bucket " + bucket'
|
2024-06-08 16:02:17 +00:00
|
|
|
# digest: 4a0a004730450220188c6eff76e5890e9487a7990ebc939706257a8d168f4e746b7a10b168f69882022100871f34e7125204a00ffb042ccaf984570af3f3a6a2c582613b4e8333a4f3ba87:922c64590222798bb761d5b6d8e72950
|