Skip to main content

🧠 AWS S3 Bucket Lifecycle Configuration is not enabled - prod.logic.yaml 🟒

Flags​

Input Type​

TypeAPI NameExtractsExtract FilesLogic Files
πŸ”’πŸ“• AWS S3 BucketCA10__CaAwsBucket__c1617

Uses​

Test Results πŸŸ’β€‹

Generated at: 2025-04-24T23:45:08.924839579Z Open

ResultIdCondition IndexCondition TextRuntime Error
🟒test1βœ”οΈ 99βœ”οΈ isDisappeared(CA10__disappearanceTime__c)βœ”οΈ null
🟒test2βœ”οΈ 199βœ”οΈ extract('CA10__versioningMfaDeleteEnabled__c') == trueβœ”οΈ null
🟒test3βœ”οΈ 399βœ”οΈ not(extract('caJsonQueryBoolean__lifecycleRulesJson_status_enabled__c'))βœ”οΈ null
🟒test4βœ”οΈ 499βœ”οΈ extract('caJsonQueryBoolean__lifecycleRulesJson_status_enabled__c')βœ”οΈ null
🟒test5βœ”οΈ 299βœ”οΈ extract('CA10__lifecycleRulesJson__c').isEmpty()βœ”οΈ null
🟒test6βœ”οΈ 101βœ”οΈ CA10__versioningMfaDeleteEnabled__c.delegatedTo(CA10__versioningStatus__c).isEmpty()βœ”οΈ null
🟒test7βœ”οΈ 301βœ”οΈ extract('CA10__lifecycleRulesJson__c').asJson().isInvalid()βœ”οΈ Expected property name or '}' in JSON at position 2 (line 1 column 3)

Generation​

FileMD5
Open/ce/ca/aws/s3/bucket-lifecycle-configuration/policy.yaml4EC805241D8CB3414AADEC0397901D17
Open/ce/ca/aws/s3/bucket-lifecycle-configuration/prod.logic.yaml77B1749E292AC9D02B0030218D321D50
Open/types/CA10__CaAwsBucket__c/object.extracts.yamlD7F01723B629E0F1265F06B9CE2EDE1F
Open/ce/ca/aws/s3/bucket-lifecycle-configuration/test-data.json396CAB0A29D2F228E662B5FDD58E9204

Generate FULL script​

java -jar repo-manager.jar policies generate FULL /ce/ca/aws/s3/bucket-lifecycle-configuration/prod.logic.yaml

Generate DEBUG script​

java -jar repo-manager.jar policies generate DEBUG /ce/ca/aws/s3/bucket-lifecycle-configuration/prod.logic.yaml

Generate CAPTURE_TEST_DATA script​

java -jar repo-manager.jar policies generate CAPTURE_TEST_DATA /ce/ca/aws/s3/bucket-lifecycle-configuration/prod.logic.yaml

Generate TESTS script​

java -jar repo-manager.jar policies generate TESTS /ce/ca/aws/s3/bucket-lifecycle-configuration/prod.logic.yaml

Execute tests​

java -jar repo-manager.jar policies test /ce/ca/aws/s3/bucket-lifecycle-configuration/prod.logic.yaml

Content​

Open File

---
# This policy is based on ce:ca:aws:s3:enable-bucket-lifecycle-configuration.
# We're able to determine if the Lifecycle configuration is enabled on a bucket
# using the CA10__lifecycleRulesJson__c field.
# Lifecycle configuration is not supported for MFA-enabled buckets and directory buckets.
inputType: "CA10__CaAwsBucket__c"
testData:
- file: "test-data.json"
importExtracts:
- file: "/types/CA10__CaAwsBucket__c/object.extracts.yaml"
conditions:
# Lifecycle configuration on multi-factor authentication (MFA)-enabled buckets is not supported.
# https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-and-other-bucket-config.html#lifecycle-general-considerations-mfa-enabled-bucket
- status: "INAPPLICABLE"
currentStateMessage: "Lifecycle configuration on multi-factor authentication (MFA)-enabled buckets is not supported."
check:
IS_EQUAL:
left:
EXTRACT: "CA10__versioningMfaDeleteEnabled__c"
right:
BOOLEAN: true
- status: "INCOMPLIANT"
currentStateMessage: "The bucket doesn't have a Lifecycle configuration."
remediationMessage: "Consider creating an S3 Lifecycle configuration for the bucket."
check:
IS_EMPTY:
arg:
EXTRACT: "CA10__lifecycleRulesJson__c"
- status: "INCOMPLIANT"
currentStateMessage: "Bucket Lifecycle configuration rules are disabled."
remediationMessage: "Consider enabling or adding active rules to the bucket Lifecycle configuration."
check:
NOT:
arg:
EXTRACT: "caJsonQueryBoolean__lifecycleRulesJson_status_enabled__c"
- status: "COMPLIANT"
currentStateMessage: "The bucket Lifecycle configuration is enabled."
check:
EXTRACT: "caJsonQueryBoolean__lifecycleRulesJson_status_enabled__c"
otherwise:
status: "UNDETERMINED"
currentStateMessage: "Unexpected values in the fields."