--- policy: /ce/ca/aws/cloudfront/distribution-logging logic: /ce/ca/aws/cloudfront/distribution-logging/prod.logic.yaml executionTime: 2026-06-06T12:02:32.602539122Z generationMs: 62 executionMs: 1070 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__loggingEnabled__c') == false actual: extract('CA10__loggingEnabled__c') == false runtimeError: {} - id: test3 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 199 actual: 199 conditionText: expected: extract('CA10__loggingEnabled__c') == false actual: extract('CA10__loggingEnabled__c') == false runtimeError: {} - id: test4 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 200 actual: 200 conditionText: expected: otherwise actual: otherwise runtimeError: {} usedFiles: - path: /ce/ca/aws/cloudfront/distribution-logging/policy.yaml md5Hash: 57B501D217EB19EA79BCFAE07C7C4087 content: |- --- names: full: AWS CloudFront Distribution Logging is not enabled contextual: Distribution Logging is not enabled description: > Ensure that standard logging is enabled for CloudFront Web Distributions. categories: - "SECURITY" - "RELIABILITY" type: "COMPLIANCE_POLICY" frameworkMappings: - "/frameworks/cloudaware/logging-and-monitoring/logging-and-monitoring-configuration" - "/frameworks/aws-fsbp-v1.0.0/cloudfront/05" similarPolicies: awsSecurityHub: - name: "[CloudFront.5] CloudFront distributions should have logging enabled" url: "https://docs.aws.amazon.com/securityhub/latest/userguide/cloudfront-controls.html#cloudfront-5" internal: - "dec-x-a5c2acfe" - path: /ce/ca/aws/cloudfront/distribution-logging/prod.logic.yaml md5Hash: B5ADD5DF88F76D4B37ABC4CDE4B1615D content: "---\ninputType: \"CA10__CaAwsDistribution__c\"\nimportExtracts:\n -\ \ file: \"/types/CA10__CaAwsDistribution__c/object.extracts.yaml\"\ntestData:\n\ \ - file: \"test-data.json\" \nconditions:\n - status: \"INCOMPLIANT\"\n\ \ currentStateMessage: \"Standard logging is not enabled for the CloudFront\ \ distribution.\"\n remediationMessage: \"Enable standard logging for the\ \ CloudFront distribution.\"\n check:\n IS_EQUAL:\n left:\n \ \ EXTRACT: \"CA10__loggingEnabled__c\"\n right:\n BOOLEAN:\ \ false\notherwise:\n status: \"COMPLIANT\"\n currentStateMessage: \"Standard\ \ logging is enabled for the CloudFront distribution.\"\n" - path: /ce/ca/aws/cloudfront/distribution-logging/test-data.json md5Hash: 68C147366A270B0FC2503DC0CB1C39C1 content: |- [ { "expectedResult": { "status": "DISAPPEARED", "conditionIndex": "99", "conditionText": "isDisappeared(CA10__disappearanceTime__c)", "runtimeError": null }, "context": { "snapshotTime": "2025-05-10T18:55:17Z" }, "Id": "test1", "RecordTypeId": "RecordTypeId1", "CA10__disappearanceTime__c": "2025-05-10T18:55:17Z", "CA10__loggingEnabled__c": false, "RecordType": { "DeveloperName": "caRtmpDistribution", "Id": "RecordTypeId1" } }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "199", "conditionText": "extract('CA10__loggingEnabled__c') == false", "runtimeError": null }, "context": { "snapshotTime": "2025-05-10T18:55:17Z" }, "Id": "test2", "RecordTypeId": "RecordTypeId1", "CA10__disappearanceTime__c": null, "CA10__loggingEnabled__c": false, "RecordType": { "DeveloperName": "caRtmpDistribution", "Id": "RecordTypeId1" } }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "199", "conditionText": "extract('CA10__loggingEnabled__c') == false", "runtimeError": null }, "context": { "snapshotTime": "2025-05-10T18:55:17Z" }, "Id": "test3", "RecordTypeId": "RecordTypeId2", "CA10__disappearanceTime__c": null, "CA10__loggingEnabled__c": false, "RecordType": { "DeveloperName": "caWebDistribution", "Id": "RecordTypeId2" } }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "200", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2025-05-10T18:55:17Z" }, "Id": "test4", "RecordTypeId": "RecordTypeId2", "CA10__disappearanceTime__c": null, "CA10__loggingEnabled__c": true, "RecordType": { "DeveloperName": "caWebDistribution", "Id": "RecordTypeId2" } } ] - path: /types/CA10__CaAwsDistribution__c/object.extracts.yaml md5Hash: 9BBABDA14FE5FD983E28F77F5CC80BF9 content: |- --- extracts: # Nullable - name: "CA10__defaultRootObject__c" value: FIELD: path: CA10__defaultRootObject__c # undeterminedIf: # noAccessDelegate: # path: "CA10__defaultRootObject__c" # currentStateMessage: "Unable to determine Default Root Object. Possible permission issue with cloudfront:GetDistribution." # Checkbox - name: "CA10__loggingEnabled__c" value: FIELD: path: "CA10__loggingEnabled__c" # Checkbox - name: "CA10__viewerCertificateCloudFrontDefaultCert__c" value: FIELD: path: "CA10__viewerCertificateCloudFrontDefaultCert__c" # Values: sni-only | vip | static-ip. Nullable - name: "CA10__viewerCertificateSslSupportMethod__c" value: FIELD: path: "CA10__viewerCertificateSslSupportMethod__c" # undeterminedIf: # noAccessDelegate: # path: "CA10__defaultRootObject__c" # currentStateMessage: "Unable to determine Viewer Certificate SSL Support Method. Possible permission issue with cloudfront:GetDistribution." # Text. Nullable - name: "CA10__viewerCertificateMinimumProtocolVersion__c" value: FIELD: path: "CA10__viewerCertificateMinimumProtocolVersion__c" # Text. Nullable - name: "CA10__s3OriginDomainName__c" value: FIELD: path: "CA10__s3OriginDomainName__c" # Text. Nullable - name: "CA10__s3OriginAccessIdentity__c" value: FIELD: path: "CA10__s3OriginAccessIdentity__c" 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__loggingEnabled__c') == false", "runtimeError" : null } }, { "Id" : "test3", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "199", "conditionText" : "extract('CA10__loggingEnabled__c') == false", "runtimeError" : null } }, { "Id" : "test4", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "200", "conditionText" : "otherwise", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsDistribution__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-05-10T18:55:17Z") }, "CA10__disappearanceTime__c" : new Date("2025-05-10T18:55:17Z"), "CA10__loggingEnabled__c" : false, "Id" : "test1", "RecordTypeId" : "RecordTypeId1" }, { "context" : { "snapshotTime" : new Date("2025-05-10T18:55:17Z") }, "CA10__loggingEnabled__c" : false, "Id" : "test2", "RecordTypeId" : "RecordTypeId1" }, { "context" : { "snapshotTime" : new Date("2025-05-10T18:55:17Z") }, "CA10__loggingEnabled__c" : false, "Id" : "test3", "RecordTypeId" : "RecordTypeId2" }, { "context" : { "snapshotTime" : new Date("2025-05-10T18:55:17Z") }, "CA10__loggingEnabled__c" : true, "Id" : "test4", "RecordTypeId" : "RecordTypeId2" } ]; """; CREATE TEMP FUNCTION mock_RecordType() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-05-10T18:55:17Z") }, "Id" : "RecordTypeId1" }, { "context" : { "snapshotTime" : new Date("2025-05-10T18:55:17Z") }, "Id" : "RecordTypeId2" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsDistribution__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__loggingEnabled__c BOOLEAN, Id STRING, RecordTypeId STRING, RecordType STRUCT< 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__loggingEnabled__c; } return this.out; }; references1.push('Logging Enabled [obj.CA10__loggingEnabled__c]: ' + obj.CA10__loggingEnabled__c); if (extract3.call(extract3) == false) { return {status: 'INCOMPLIANT', conditionIndex: 199, conditionText: "extract('CA10__loggingEnabled__c') == false", currentStateMessage: "Standard logging is not enabled for the CloudFront distribution.", currentStateReferences: references1.join('\n'), remediation: "Enable standard logging for the CloudFront distribution.", runtimeError: null}; } return {status: 'COMPLIANT', conditionIndex: 200, conditionText: "otherwise", currentStateMessage: "Standard logging is enabled for the CloudFront distribution.", 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__loggingEnabled__c AS CA10__loggingEnabled__c, sObject.Id AS Id, sObject.RecordTypeId AS RecordTypeId, STRUCT ( `RecordType`.Id AS Id ) AS RecordType, process_CA10__CaAwsDistribution__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__loggingEnabled__c AS CA10__loggingEnabled__c, sObject.Id AS Id, sObject.RecordTypeId AS RecordTypeId, STRUCT ( `RecordType`.Id AS Id ) AS RecordType ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAwsDistribution__c()) AS sObject LEFT JOIN UNNEST(mock_RecordType()) AS `RecordType` ON sObject.RecordTypeId = `RecordType`.Id ) sObject ON sObject.Id = expectedResult.Id;