An AWS CDK S3 bucket is defined without versioning, so an overwrite or delete cannot be undone

tx0/python:s3-bucket-without-versioningstrictnotesecurity/iacdepth fastsecurity

What it finds

Without versioned=True, writing an object replaces the old data and deleting it removes it for good, whether by mistake, by a bug or by an attacker. Versioning keeps the previous versions recoverable.

From the rule's source, s3_bucket_without_versioning.rs.

Example from the rule's tests
from aws_cdk import aws_s3 as s3 def stack(scope):    s3.Bucket(scope, "Logs")tx0 reports: this bucket keeps no earlier versions    s3.Bucket(scope, "Data", versioned=True)
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/python:s3-bucket-without-versioning" = "note"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

# tx0: ignore[tx0/python:s3-bucket-without-versioning] reason="..."

tx0 explain tx0/python:s3-bucket-without-versioning shows the same in the terminal. Found a false positive? Report it.