--- policy: /ce/ca/aws/secrets-manager/secret-automatic-rotation logic: /ce/ca/aws/secrets-manager/secret-automatic-rotation/prod.logic.yaml executionTime: 2026-02-10T22:33:20.489420725Z generationMs: 50 executionMs: 1047 rows: - id: test1 match: true status: expected: DISAPPEARED actual: DISAPPEARED conditionIndex: expected: 99 actual: 99 conditionText: expected: isDisappeared(CA10A1__disappearanceTime__c) actual: isDisappeared(CA10A1__disappearanceTime__c) runtimeError: {} - id: test2 match: true status: expected: INAPPLICABLE actual: INAPPLICABLE conditionIndex: expected: 199 actual: 199 conditionText: expected: extract('CA10A1__deletedDate__c').isNotEmpty() actual: extract('CA10A1__deletedDate__c').isNotEmpty() runtimeError: {} - id: test3 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 399 actual: 399 conditionText: expected: extract('CA10A1__rotationEnabled__c') == true actual: extract('CA10A1__rotationEnabled__c') == true runtimeError: {} - id: test4 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 299 actual: 299 conditionText: expected: extract('CA10A1__rotationEnabled__c') == false actual: extract('CA10A1__rotationEnabled__c') == false runtimeError: {} usedFiles: - path: /ce/ca/aws/secrets-manager/secret-automatic-rotation/policy.yaml md5Hash: 3673698FC013CAE752B5052631076649 content: "---\nnames:\n full: \"AWS Secrets Manager Secret Automatic Rotation\ \ is not enabled\"\n contextual: \"Secret Automatic Rotation is not enabled\"\ \ndescription: >\n Ensure that secrets stored in AWS Secrets Manager are configured\ \ for automatic \n rotation to minimize the risk associated with long-lived\ \ credentials\ntype: \"COMPLIANCE_POLICY\"\ncategories:\n - \"SECURITY\"\n\ frameworkMappings:\n - \"/frameworks/cloudaware/secret-and-certificate-governance/expiration-management\"\ \n - \"/frameworks/aws-fsbp-v1.0.0/secrets-manager/01\"\n - \"/frameworks/aws-well-architected/sec/02/03\"\ \nsimilarPolicies:\n awsSecurityHub:\n - name: \"[SecretsManager.1] Secrets\ \ Manager secrets should have automatic rotation enabled\"\n url: \"https://docs.aws.amazon.com/securityhub/latest/userguide/secretsmanager-controls.html#secretsmanager-1\"" - path: /ce/ca/aws/secrets-manager/secret-automatic-rotation/prod.logic.yaml md5Hash: 40AD335BF1CE5354B63179C122716E74 content: | --- inputType: "CA10A1__CaAwsSecretsManagerSecret__c" testData: - file: "test-data.json" importExtracts: - file: "/types/CA10A1__CaAwsSecretsManagerSecret__c/object.extracts.yaml" conditions: - status: "INAPPLICABLE" currentStateMessage: "This secret is not active." check: NOT_EMPTY: arg: EXTRACT: "CA10A1__deletedDate__c" - status: "INCOMPLIANT" currentStateMessage: "Automatic rotation is not enabled for this secret." remediationMessage: "Enable automatic rotation to reduce the risk of long-lived credentials being compromised." check: IS_EQUAL: left: EXTRACT: "CA10A1__rotationEnabled__c" right: BOOLEAN: false - status: "COMPLIANT" currentStateMessage: "Automatic rotation is enabled for this secret." check: IS_EQUAL: left: EXTRACT: "CA10A1__rotationEnabled__c" right: BOOLEAN: true otherwise: status: "UNDETERMINED" currentStateMessage: "Unexpected values in the fields." - path: /ce/ca/aws/secrets-manager/secret-automatic-rotation/test-data.json md5Hash: 257226E972292860D961B63294E5CEFC content: |- [ { "expectedResult": { "status": "DISAPPEARED", "conditionIndex": "99", "conditionText": "isDisappeared(CA10A1__disappearanceTime__c)", "runtimeError": null }, "context": { "snapshotTime": "2025-10-23T14:48:06Z" }, "CA10A1__disappearanceTime__c": "2025-10-16T20:08:56Z", "CA10A1__deletedDate__c": null, "CA10A1__rotationEnabled__c": false, "Id": "test1" }, { "expectedResult": { "status": "INAPPLICABLE", "conditionIndex": "199", "conditionText": "extract('CA10A1__deletedDate__c').isNotEmpty()", "runtimeError": null }, "context": { "snapshotTime": "2025-10-23T14:48:06Z" }, "CA10A1__disappearanceTime__c": null, "CA10A1__deletedDate__c": "2025-10-23T14:48:06Z", "CA10A1__rotationEnabled__c": true, "Id": "test2" }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "399", "conditionText": "extract('CA10A1__rotationEnabled__c') == true", "runtimeError": null }, "context": { "snapshotTime": "2025-10-23T14:48:06Z" }, "CA10A1__disappearanceTime__c": null, "CA10A1__deletedDate__c": null, "CA10A1__rotationEnabled__c": true, "Id": "test3" }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "299", "conditionText": "extract('CA10A1__rotationEnabled__c') == false", "runtimeError": null }, "context": { "snapshotTime": "2025-10-23T14:48:06Z" }, "CA10A1__disappearanceTime__c": null, "CA10A1__deletedDate__c": null, "CA10A1__rotationEnabled__c": false, "Id": "test4" } ] - path: /types/CA10A1__CaAwsSecretsManagerSecret__c/object.extracts.yaml md5Hash: EE2C582B7F073CDD9BCEC537B36DB97A content: "---\nextracts:\n# Nullable. Can't have no access, retrieved via secretsmanager:ListSecrets\n\ \ - name: CA10A1__deletedDate__c\n value:\n FIELD: \n path:\ \ CA10A1__deletedDate__c\n# Checkbox. Can't have no access, retrieved via secretsmanager:ListSecrets\n\ \ - name: CA10A1__rotationEnabled__c\n value:\n FIELD: \n path:\ \ CA10A1__rotationEnabled__c\n# Nullable. Can't have no access, retrieved via\ \ secretsmanager:ListSecrets\n - name: CA10A1__lastAccessedDate__c\n value:\n\ \ FIELD: \n path: CA10A1__lastAccessedDate__c\n# Not nullable. Can't\ \ have no access, retrieved via secretsmanager:ListSecrets\n - name: CA10A1__lastChangedDate__c\n\ \ value:\n FIELD: \n path: CA10A1__lastChangedDate__c\n# Nullable.\ \ Can't have no access, retrieved via secretsmanager:ListSecrets\n - name:\ \ CA10A1__lastRotatedDate__c\n value:\n FIELD: \n path: CA10A1__lastRotatedDate__c\n" script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "test1", "expectedResult" : { "status" : "DISAPPEARED", "conditionIndex" : "99", "conditionText" : "isDisappeared(CA10A1__disappearanceTime__c)", "runtimeError" : null } }, { "Id" : "test2", "expectedResult" : { "status" : "INAPPLICABLE", "conditionIndex" : "199", "conditionText" : "extract('CA10A1__deletedDate__c').isNotEmpty()", "runtimeError" : null } }, { "Id" : "test3", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "399", "conditionText" : "extract('CA10A1__rotationEnabled__c') == true", "runtimeError" : null } }, { "Id" : "test4", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "299", "conditionText" : "extract('CA10A1__rotationEnabled__c') == false", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10A1__CaAwsSecretsManagerSecret__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-10-23T14:48:06Z") }, "CA10A1__disappearanceTime__c" : new Date("2025-10-16T20:08:56Z"), "CA10A1__rotationEnabled__c" : false, "Id" : "test1" }, { "context" : { "snapshotTime" : new Date("2025-10-23T14:48:06Z") }, "CA10A1__deletedDate__c" : new Date("2025-10-23T14:48:06Z"), "CA10A1__rotationEnabled__c" : true, "Id" : "test2" }, { "context" : { "snapshotTime" : new Date("2025-10-23T14:48:06Z") }, "CA10A1__rotationEnabled__c" : true, "Id" : "test3" }, { "context" : { "snapshotTime" : new Date("2025-10-23T14:48:06Z") }, "CA10A1__rotationEnabled__c" : false, "Id" : "test4" } ]; """; CREATE TEMP FUNCTION process_CA10A1__CaAwsSecretsManagerSecret__c( obj STRUCT< CA10A1__disappearanceTime__c TIMESTAMP, CA10A1__deletedDate__c TIMESTAMP, CA10A1__rotationEnabled__c BOOLEAN, Id STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" var IsEmptyLib = new function () { this.simpleIsEmpty = function(arg) { return arg == null; }; this.simpleIsNotEmpty = function(arg) { return arg != null; }; }(); var references1 = []; // condition[0], conditionIndex:[0..99] references1.push('Deleted From AWS [CA10A1__disappearanceTime__c]: ' + obj.CA10A1__disappearanceTime__c); if (obj.CA10A1__disappearanceTime__c != null) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10A1__disappearanceTime__c)", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[1], conditionIndex:[100..199] function extract3() { if (!this.out) { this.out = obj.CA10A1__deletedDate__c; } return this.out; }; references1.push('Deleted Date [obj.CA10A1__deletedDate__c]: ' + obj.CA10A1__deletedDate__c); if (IsEmptyLib.simpleIsNotEmpty(extract3.call(extract3))) { return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "extract('CA10A1__deletedDate__c').isNotEmpty()", currentStateMessage: "This secret is not active.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[2], conditionIndex:[200..299] function extract6() { if (!this.out) { this.out = obj.CA10A1__rotationEnabled__c; } return this.out; }; references1.push('Rotation Enabled [obj.CA10A1__rotationEnabled__c]: ' + obj.CA10A1__rotationEnabled__c); if (extract6.call(extract6) == false) { return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "extract('CA10A1__rotationEnabled__c') == false", currentStateMessage: "Automatic rotation is not enabled for this secret.", currentStateReferences: references1.join('\n'), remediation: "Enable automatic rotation to reduce the risk of long-lived credentials being compromised.", runtimeError: null}; } // condition[3], conditionIndex:[300..399] function extract9() { if (!this.out) { this.out = obj.CA10A1__rotationEnabled__c; } return this.out; }; if (extract9.call(extract9) == true) { return {status: 'COMPLIANT', conditionIndex: 399, conditionText: "extract('CA10A1__rotationEnabled__c') == true", currentStateMessage: "Automatic rotation is enabled for this secret.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'UNDETERMINED', conditionIndex: 400, conditionText: "otherwise", currentStateMessage: "Unexpected values in the fields.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; """; SELECT expectedResult.Id as Id, IF ( IFNULL(expectedResult.expectedResult.status, '') = IFNULL(sObject.result.status, '') AND IFNULL(expectedResult.expectedResult.conditionIndex, -1) = IFNULL(sObject.result.conditionIndex, -1) AND IFNULL(expectedResult.expectedResult.conditionText, '') = IFNULL(sObject.result.conditionText, '') AND IFNULL(expectedResult.expectedResult.runtimeError, '') = IFNULL(sObject.result.runtimeError, ''), "MATCH", "FAIL" ) as match, expectedResult.expectedResult.status as expectedStatus, sObject.result.status as actualStatus, expectedResult.expectedResult.conditionIndex as expectedConditionIndex, sObject.result.conditionIndex as actualConditionIndex, expectedResult.expectedResult.conditionText as expectedConditionText, sObject.result.conditionText as actualConditionText, expectedResult.expectedResult.runtimeError as expectedRuntimeError, sObject.result.runtimeError as actualRuntimeError FROM UNNEST(mock_ExpectedResult()) expectedResult LEFT JOIN ( SELECT sObject.CA10A1__disappearanceTime__c AS CA10A1__disappearanceTime__c, sObject.CA10A1__deletedDate__c AS CA10A1__deletedDate__c, sObject.CA10A1__rotationEnabled__c AS CA10A1__rotationEnabled__c, sObject.Id AS Id, process_CA10A1__CaAwsSecretsManagerSecret__c( STRUCT( sObject.CA10A1__disappearanceTime__c AS CA10A1__disappearanceTime__c, sObject.CA10A1__deletedDate__c AS CA10A1__deletedDate__c, sObject.CA10A1__rotationEnabled__c AS CA10A1__rotationEnabled__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10A1__CaAwsSecretsManagerSecret__c()) AS sObject ) sObject ON sObject.Id = expectedResult.Id;