--- policy: /ce/ca/aws/cloudtrail/log-file-validation logic: /ce/ca/aws/cloudtrail/log-file-validation/prod.logic.yaml executionTime: 2026-06-06T12:02:34.739156154Z generationMs: 48 executionMs: 1112 rows: - id: test1 match: true status: expected: DISAPPEARED actual: DISAPPEARED conditionIndex: expected: 99 actual: 99 conditionText: expected: isDisappeared(CA10__disappearanceTime__c) actual: isDisappeared(CA10__disappearanceTime__c) runtimeError: {} - id: test2 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 199 actual: 199 conditionText: expected: extract('CA10__logFileValidationEnabled__c') == false actual: extract('CA10__logFileValidationEnabled__c') == false runtimeError: {} - id: test3 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 299 actual: 299 conditionText: expected: extract('CA10__logFileValidationEnabled__c') == true actual: extract('CA10__logFileValidationEnabled__c') == true runtimeError: {} - id: test4 match: true status: expected: UNDETERMINED actual: UNDETERMINED conditionIndex: expected: 300 actual: 300 conditionText: expected: otherwise actual: otherwise runtimeError: {} usedFiles: - path: /ce/ca/aws/cloudtrail/log-file-validation/policy.yaml md5Hash: A099ABAB16F5602F8694A855F1306843 content: |- --- names: full: AWS CloudTrail Log File Validation is not enabled contextual: Log File Validation is not enabled description: "CloudTrail log file validation creates a digitally signed digest file\ \ containing a hash of each log that CloudTrail writes to S3. These digest files\ \ can be used to determine whether a log file was changed, deleted, or unchanged\ \ after CloudTrail delivered the log. It is recommended that file validation be\ \ enabled on all CloudTrails." type: COMPLIANCE_POLICY categories: - "SECURITY" - "RELIABILITY" frameworkMappings: - "/frameworks/cis-aws-v7.0.0/04/02" - "/frameworks/cloudaware/logging-and-monitoring/logging-and-monitoring-configuration" - "/frameworks/aws-fsbp-v1.0.0/cloudtrail/04" similarPolicies: awsSecurityHub: - name: "[CloudTrail.4] CloudTrail log file validation should be enabled" url: "https://docs.aws.amazon.com/securityhub/latest/userguide/cloudtrail-controls.html#cloudtrail-4" cloudConformity: - url: https://www.trendmicro.com/cloudoneconformity/knowledge-base/aws/CloudTrail/cloudtrail-log-file-integrity-validation.html name: CloudTrail Log File Integrity Validation internal: - dec-x-b1e1a494 - path: /ce/ca/aws/cloudtrail/log-file-validation/prod.logic.yaml md5Hash: 8012C1AA018EE0CCA2475D066C5DA286 content: | --- inputType: "CA10__CaAwsCloudTrailTrail__c" testData: - file: "test-data.json" importExtracts: - file: "/types/CA10__CaAwsCloudTrailTrail__c/object.extracts.yaml" conditions: - status: "INCOMPLIANT" currentStateMessage: "CloudTrail Log File Validation is disabled." remediationMessage: "Enable CloudTrail log file validation." check: IS_EQUAL: left: EXTRACT: "CA10__logFileValidationEnabled__c" right: BOOLEAN: false - status: "COMPLIANT" currentStateMessage: "CloudTrail log file validation is enabled." check: IS_EQUAL: left: EXTRACT: "CA10__logFileValidationEnabled__c" right: BOOLEAN: true otherwise: status: "UNDETERMINED" currentStateMessage: "Unexpected values in the field." - path: /ce/ca/aws/cloudtrail/log-file-validation/test-data.json md5Hash: 37B4E56A1FF545D51AF96BD8991E3EC6 content: |- [ { "expectedResult": { "status": "DISAPPEARED", "conditionIndex": "99", "conditionText": "isDisappeared(CA10__disappearanceTime__c)", "runtimeError": null }, "context": { "snapshotTime": "2024-05-28T17:35:50Z" }, "Id": "test1", "CA10__disappearanceTime__c": "2024-05-28T17:35:50Z", "CA10__logFileValidationEnabled__c": true }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "199", "conditionText": "extract('CA10__logFileValidationEnabled__c') == false", "runtimeError": null }, "context": { "snapshotTime": "2024-05-28T17:35:50Z" }, "Id": "test2", "CA10__disappearanceTime__c": null, "CA10__logFileValidationEnabled__c": false }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "299", "conditionText": "extract('CA10__logFileValidationEnabled__c') == true", "runtimeError": null }, "context": { "snapshotTime": "2024-05-28T17:35:50Z" }, "Id": "test3", "CA10__disappearanceTime__c": null, "CA10__logFileValidationEnabled__c": true }, { "expectedResult": { "status": "UNDETERMINED", "conditionIndex": "300", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2024-05-28T17:35:50Z" }, "Id": "test4", "CA10__disappearanceTime__c": null, "CA10__logFileValidationEnabled__c": null } ] - path: /types/CA10__CaAwsCloudTrailTrail__c/object.extracts.yaml md5Hash: E81F4D5C3A3DF3406D05985DF80BF9C5 content: "---\nextracts:\n# Checkbox. Can't have no access, retrieved via cloudtrail:DescribeTrails\n\ \ - name: \"CA10__multiRegionTrail__c\"\n value: \n FIELD:\n \ \ path: \"CA10__multiRegionTrail__c\"\n# Checkbox. \n - name: \"CA10__isLogging__c\"\ \n value: \n FIELD:\n path: \"CA10__isLogging__c\"\n undeterminedIf:\n\ \ noAccessDelegate:\n path: \"CA10__isLogging__c\"\n \ \ currentStateMessage: \"Unable to determine Logging status. Possible\ \ permission issue with cloudtrail:GetTrailStatus.\"\n# Checkbox. Can't have\ \ no access, retrieved via cloudtrail:DescribeTrails\n - name: \"CA10__logFileValidationEnabled__c\"\ \n value: \n FIELD:\n path: \"CA10__logFileValidationEnabled__c\"\ \n# Nullable\n - name: \"CA10__eventSelectorsJson__c\"\n value: \n \ \ FIELD:\n path: \"CA10__eventSelectorsJson__c\"\n returnType:\ \ BYTES\n undeterminedIf:\n noAccessDelegate:\n path:\ \ \"CA10__eventSelectorsJson__c\"\n currentStateMessage: \"Unable\ \ to determine Logging status. Possible permission issue with cloudtrail:GetEventSelectors.\"\ \n - name: \"caJsonFrom__eventSelectorsJson__c\"\n value: \n JSON_FROM:\n\ \ arg:\n EXTRACT: \"CA10__eventSelectorsJson__c\"\n undeterminedIf:\n\ \ isInvalid: \"Provided CloudTrail Event Selector has invalid JSON.\"\ \n# Returns TEXT. Values: All, WriteOnly, ReadOnly\n - name: \"caJsonText__eventSelectorsJsonReadWriteType__c\"\ \n value: \n JSON_QUERY_TEXT:\n arg: \n EXTRACT: \"\ caJsonFrom__eventSelectorsJson__c\"\n expression: \"[*].readWriteType\ \ | [0]\"\n undeterminedIf:\n evaluationError: \"The JSON text\ \ query has failed.\"\n resultTypeMismatch: \"The JSON query did not\ \ return a text type.\"\n# Returns BOOLEAN true or false\n - name: \"caJsonBoolean__eventSelectorsJsonIncludeManagementEvents__c\"\ \n value: \n JSON_QUERY_BOOLEAN:\n arg: \n EXTRACT:\ \ \"caJsonFrom__eventSelectorsJson__c\"\n expression: \"[*].includeManagementEvents\ \ | [0]\"\n undeterminedIf:\n evaluationError: \"The JSON boolean\ \ query has failed.\"\n resultTypeMismatch: \"The JSON query did not\ \ return a boolean type.\"\n# Nullable. Can't have no access, retrieved via\ \ cloudtrail:DescribeTrails\n - name: \"CA10__kmsKey__c\"\n value: \n \ \ FIELD:\n path: \"CA10__kmsKey__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(CA10__disappearanceTime__c)", "runtimeError" : null } }, { "Id" : "test2", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "199", "conditionText" : "extract('CA10__logFileValidationEnabled__c') == false", "runtimeError" : null } }, { "Id" : "test3", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "299", "conditionText" : "extract('CA10__logFileValidationEnabled__c') == true", "runtimeError" : null } }, { "Id" : "test4", "expectedResult" : { "status" : "UNDETERMINED", "conditionIndex" : "300", "conditionText" : "otherwise", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsCloudTrailTrail__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2024-05-28T17:35:50Z") }, "CA10__disappearanceTime__c" : new Date("2024-05-28T17:35:50Z"), "CA10__logFileValidationEnabled__c" : true, "Id" : "test1" }, { "context" : { "snapshotTime" : new Date("2024-05-28T17:35:50Z") }, "CA10__logFileValidationEnabled__c" : false, "Id" : "test2" }, { "context" : { "snapshotTime" : new Date("2024-05-28T17:35:50Z") }, "CA10__logFileValidationEnabled__c" : true, "Id" : "test3" }, { "context" : { "snapshotTime" : new Date("2024-05-28T17:35:50Z") }, "CA10__logFileValidationEnabled__c" : null, "Id" : "test4" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsCloudTrailTrail__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__logFileValidationEnabled__c BOOLEAN, Id STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" var references1 = []; // condition[0], conditionIndex:[0..99] references1.push('Deleted From AWS [CA10__disappearanceTime__c]: ' + obj.CA10__disappearanceTime__c); if (obj.CA10__disappearanceTime__c != null) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10__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.CA10__logFileValidationEnabled__c; } return this.out; }; references1.push('Log File Validation Enabled [obj.CA10__logFileValidationEnabled__c]: ' + obj.CA10__logFileValidationEnabled__c); if (extract3.call(extract3) == false) { return {status: 'INCOMPLIANT', conditionIndex: 199, conditionText: "extract('CA10__logFileValidationEnabled__c') == false", currentStateMessage: "CloudTrail Log File Validation is disabled.", currentStateReferences: references1.join('\n'), remediation: "Enable CloudTrail log file validation.", runtimeError: null}; } // condition[2], conditionIndex:[200..299] function extract6() { if (!this.out) { this.out = obj.CA10__logFileValidationEnabled__c; } return this.out; }; if (extract6.call(extract6) == true) { return {status: 'COMPLIANT', conditionIndex: 299, conditionText: "extract('CA10__logFileValidationEnabled__c') == true", currentStateMessage: "CloudTrail log file validation is enabled.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'UNDETERMINED', conditionIndex: 300, conditionText: "otherwise", currentStateMessage: "Unexpected values in the field.", 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.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__logFileValidationEnabled__c AS CA10__logFileValidationEnabled__c, sObject.Id AS Id, process_CA10__CaAwsCloudTrailTrail__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__logFileValidationEnabled__c AS CA10__logFileValidationEnabled__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAwsCloudTrailTrail__c()) AS sObject ) sObject ON sObject.Id = expectedResult.Id;