--- policy: /ce/ca/aws/cloudfront/distribution-uses-outdated-ssl-protocols logic: /ce/ca/aws/cloudfront/distribution-uses-outdated-ssl-protocols/prod.logic.yaml executionTime: 2026-06-06T12:02:35.294260435Z generationMs: 55 executionMs: 2331 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: INAPPLICABLE actual: INAPPLICABLE conditionIndex: expected: 199 actual: 199 conditionText: expected: "not(setOfText(['caWebDistribution']).contains(RecordType.DeveloperName))" actual: "not(setOfText(['caWebDistribution']).contains(RecordType.DeveloperName))" runtimeError: {} - id: test3 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 299 actual: 299 conditionText: expected: CA10__AWS_CloudFront_Origins__r.has(INCOMPLIANT) actual: CA10__AWS_CloudFront_Origins__r.has(INCOMPLIANT) runtimeError: {} - id: test4 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 399 actual: 399 conditionText: expected: CA10__AWS_CloudFront_Origins__r.has(COMPLIANT) actual: CA10__AWS_CloudFront_Origins__r.has(COMPLIANT) runtimeError: {} - id: test5 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 500 actual: 500 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: test6 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 500 actual: 500 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: test7 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 500 actual: 500 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: test8 match: true status: expected: UNDETERMINED actual: UNDETERMINED conditionIndex: expected: 499 actual: 499 conditionText: expected: CA10__AWS_CloudFront_Origins__r.hasNo(INAPPLICABLE) && CA10__AWS_CloudFront_Origins__r.hasNo(UNDETERMINED) actual: CA10__AWS_CloudFront_Origins__r.hasNo(INAPPLICABLE) && CA10__AWS_CloudFront_Origins__r.hasNo(UNDETERMINED) runtimeError: {} - id: test9 match: true status: expected: UNDETERMINED actual: UNDETERMINED conditionIndex: expected: 499 actual: 499 conditionText: expected: CA10__AWS_CloudFront_Origins__r.hasNo(INAPPLICABLE) && CA10__AWS_CloudFront_Origins__r.hasNo(UNDETERMINED) actual: CA10__AWS_CloudFront_Origins__r.hasNo(INAPPLICABLE) && CA10__AWS_CloudFront_Origins__r.hasNo(UNDETERMINED) runtimeError: {} usedFiles: - path: /ce/ca/aws/cloudfront/distribution-uses-outdated-ssl-protocols/policy.yaml md5Hash: 101BE6B332BF2593AE97484616BC6AEE content: "---\nnames:\n full: AWS CloudFront Web Distribution uses outdated SSL\ \ protocols with Custom Origins\n contextual: Web Distribution uses outdated\ \ SSL protocols with Custom Origins\ndescription: >\n Ensure that AWS CloudFront\ \ Web Distributions are configured to use TLSv1.2 or \n later SSL/TLS protocols\ \ to protect data in transit. Older protocols like SSLv3 \n and early TLS versions\ \ have known vulnerabilities and should be disabled.\ncategories:\n - \"SECURITY\"\ \ntype: \"COMPLIANCE_POLICY\"\nframeworkMappings:\n - \"/frameworks/cloudaware/secret-and-certificate-governance/cryptographic-configuration\"\ \n - \"/frameworks/aws-fsbp-v1.0.0/cloudfront/10\"\nsimilarPolicies:\n awsSecurityHub:\n\ \ - name: \"[CloudFront.10] CloudFront distributions should not use deprecated\ \ SSL protocols between edge locations and custom origins\"\n url: \"https://docs.aws.amazon.com/securityhub/latest/userguide/cloudfront-controls.html#cloudfront-10\"\ \n internal:\n - \"dec-x-4002ecfe\"" - path: /ce/ca/aws/cloudfront/distribution-uses-outdated-ssl-protocols/prod.logic.yaml md5Hash: 178738147C12B645AC21FFF973286091 content: "---\ninputType: \"CA10__CaAwsDistribution__c\"\nimportExtracts:\n -\ \ file: \"/types/CA10__CaAwsCacheBehavior2__c/object.extracts.yaml\"\ntestData:\n\ \ - file: \"test-data.json\" \nrecordTypes:\n - \"caWebDistribution\"\nconditions:\n\ \ - status: \"INCOMPLIANT\"\n currentStateMessage: \"The distribution has\ \ at least one custom origin that uses the deprecated SSL 3.0 protocol.\"\n\ \ remediationMessage: \"Update the minimum origin SSL protocol to TLSv1.2\ \ or later.\"\n check:\n RELATED_LIST_HAS:\n status: \"INCOMPLIANT\"\ \n relationshipName: \"CA10__AWS_CloudFront_Origins__r\"\n - status:\ \ \"INCOMPLIANT\"\n currentStateMessage: \"The distribution has at least\ \ one custom origin that uses the outdated TLS protocols.\"\n remediationMessage:\ \ \"Update the minimum origin SSL protocol to TLSv1.2 or later.\"\n check:\n\ \ RELATED_LIST_HAS:\n status: \"COMPLIANT\"\n relationshipName:\ \ \"CA10__AWS_CloudFront_Origins__r\" \n - status: \"UNDETERMINED\"\n currentStateMessage:\ \ \"The distribution doesn't have any origins in the CMDB.\"\n check:\n \ \ AND:\n args:\n - RELATED_LIST_HAS_NO:\n status:\ \ \"INAPPLICABLE\"\n relationshipName: \"CA10__AWS_CloudFront_Origins__r\"\ \n - RELATED_LIST_HAS_NO:\n status: \"UNDETERMINED\"\n\ \ relationshipName: \"CA10__AWS_CloudFront_Origins__r\"\notherwise:\n\ \ status: \"COMPLIANT\"\n currentStateMessage: \"All custom origins for this\ \ distribution are configured to use\\\n \\ TLSv1.2 or later SSL protocols\ \ (if applicable).\"\nrelatedLists:\n - relationshipName: \"CA10__AWS_CloudFront_Origins__r\"\ \n importExtracts:\n - file: \"/types/CA10__CaAwsOrigin2__c/object.extracts.yaml\"\ \n conditions:\n - status: \"INAPPLICABLE\"\n currentStateMessage:\ \ \"This is not a custom origin.\"\n check:\n IS_EMPTY:\n \ \ arg:\n EXTRACT: \"CA10__configProtocolPolicy__c\"\n\ \ - status: \"INAPPLICABLE\"\n currentStateMessage: \"The protocol\ \ policy for this custom origin is http-only.\"\n check:\n IS_EQUAL:\n\ \ left:\n EXTRACT: \"CA10__configProtocolPolicy__c\"\ \n right:\n TEXT: \"http-only\"\n - status: \"\ INAPPLICABLE\"\n currentStateMessage: \"This origin is an S3 bucket configured\ \ for static website hosting,\\\n \\ which does not support HTTPS.\"\ \n check:\n CONTAINS:\n arg:\n EXTRACT:\ \ \"CA10__domainName__c\"\n search:\n TEXT: \"s3-website\"\ \n - status: \"INCOMPLIANT\"\n currentStateMessage: \"The distribution\ \ allows the deprecated SSL 3.0 protocol.\"\n remediationMessage: \"\ Use TLSv1.2 or later for HTTPS communication to the origin.\"\n check:\n\ \ CONTAINS:\n arg:\n EXTRACT: \"caSetFrom__customOriginConfigOriginSslProtocols__c\"\ \n search:\n TEXT: \"SSLv3\"\n # This condition\ \ is set to COMPLIANT only to make it easier to distinguish from INCOMPLIANT\ \ in the main body of the policy\n - status: \"COMPLIANT\"\n currentStateMessage:\ \ \"The distribution allows the outdated TLS protocols.\"\n remediationMessage:\ \ \"Use TLSv1.2 or later for HTTPS communication to the origin.\"\n check:\n\ \ CONTAINS_ANY:\n arg:\n EXTRACT: \"caSetFrom__customOriginConfigOriginSslProtocols__c\"\ \n search:\n SET:\n itemType: TEXT\n\ \ items:\n - \"TLSv1.1\"\n \ \ - \"TLSv1\"\n # This is set to UNDETERMINED since COMPLIANT status is already\ \ reserved for the purpose above\n otherwise:\n status: \"UNDETERMINED\"\ \n currentStateMessage: \"The Minimum Origin SSL protocol enforces TLSv1.2\ \ or later.\"\n" - path: /ce/ca/aws/cloudfront/distribution-uses-outdated-ssl-protocols/test-data.json md5Hash: F062F41588F54EC55EE2E8A0B890DB15 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", "RecordType": { "DeveloperName": "caRtmpDistribution", "Id": "RecordTypeId1" }, "CA10__AWS_CloudFront_Origins__r": [] }, { "expectedResult": { "status": "INAPPLICABLE", "conditionIndex": "199", "conditionText": "not(setOfText(['caWebDistribution']).contains(RecordType.DeveloperName))", "runtimeError": null }, "context": { "snapshotTime": "2025-05-10T18:55:17Z" }, "Id": "test2", "RecordTypeId": "RecordTypeId1", "CA10__disappearanceTime__c": null, "RecordType": { "DeveloperName": "caRtmpDistribution", "Id": "RecordTypeId1" }, "CA10__AWS_CloudFront_Origins__r": [] }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "299", "conditionText": "CA10__AWS_CloudFront_Origins__r.has(INCOMPLIANT)", "runtimeError": null }, "context": { "snapshotTime": "2025-07-06T16:27:09Z" }, "Id": "test3", "RecordTypeId": "RecordTypeId2", "CA10__disappearanceTime__c": null, "RecordType": { "DeveloperName": "caWebDistribution", "Id": "RecordTypeId2" }, "CA10__AWS_CloudFront_Origins__r": [ { "Id": "test3_1", "CA10__disappearanceTime__c": null, "CA10__configProtocolPolicy__c": "match-viewer", "CA10__domainName__c": "domainName3", "CA10__customOriginConfigOriginSslProtocols__c": "SSLv3\nTLSv1\nTLSv1.1\nTLSv1.2", "CA10__distribution__c": "test3" } ] }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "399", "conditionText": "CA10__AWS_CloudFront_Origins__r.has(COMPLIANT)", "runtimeError": null }, "context": { "snapshotTime": "2025-07-06T16:27:09Z" }, "Id": "test4", "RecordTypeId": "RecordTypeId2", "CA10__disappearanceTime__c": null, "RecordType": { "DeveloperName": "caWebDistribution", "Id": "RecordTypeId2" }, "CA10__AWS_CloudFront_Origins__r": [ { "Id": "test4_1", "CA10__disappearanceTime__c": null, "CA10__configProtocolPolicy__c": "https-only", "CA10__domainName__c": "domainName4", "CA10__customOriginConfigOriginSslProtocols__c": "TLSv1\nTLSv1.1\nTLSv1.2", "CA10__distribution__c": "test4" } ] }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "500", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2025-07-06T16:27:09Z" }, "Id": "test5", "RecordTypeId": "RecordTypeId2", "CA10__disappearanceTime__c": null, "RecordType": { "DeveloperName": "caWebDistribution", "Id": "RecordTypeId2" }, "CA10__AWS_CloudFront_Origins__r": [ { "Id": "test5_1", "CA10__disappearanceTime__c": null, "CA10__configProtocolPolicy__c": "", "CA10__domainName__c": "domainName5", "CA10__customOriginConfigOriginSslProtocols__c": "", "CA10__distribution__c": "test5" } ] }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "500", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2025-07-06T16:27:09Z" }, "Id": "test6", "RecordTypeId": "RecordTypeId2", "CA10__disappearanceTime__c": null, "RecordType": { "DeveloperName": "caWebDistribution", "Id": "RecordTypeId2" }, "CA10__AWS_CloudFront_Origins__r": [ { "Id": "test6_1", "CA10__disappearanceTime__c": null, "CA10__configProtocolPolicy__c": "https-only", "CA10__domainName__c": "domainName6", "CA10__customOriginConfigOriginSslProtocols__c": "TLSv1.2", "CA10__distribution__c": "test6" } ] }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "500", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2025-07-06T16:27:09Z" }, "Id": "test7", "RecordTypeId": "RecordTypeId2", "CA10__disappearanceTime__c": null, "RecordType": { "DeveloperName": "caWebDistribution", "Id": "RecordTypeId2" }, "CA10__AWS_CloudFront_Origins__r": [ { "Id": "test7_1", "CA10__disappearanceTime__c": null, "CA10__configProtocolPolicy__c": "https-only", "CA10__domainName__c": "domainName7.s3-website-domainName7", "CA10__customOriginConfigOriginSslProtocols__c": "TLSv1\nTLSv1.1\nTLSv1.2", "CA10__distribution__c": "test7" } ] }, { "expectedResult": { "status": "UNDETERMINED", "conditionIndex": "499", "conditionText": "CA10__AWS_CloudFront_Origins__r.hasNo(INAPPLICABLE) && CA10__AWS_CloudFront_Origins__r.hasNo(UNDETERMINED)", "runtimeError": null }, "context": { "snapshotTime": "2025-07-06T16:27:09Z" }, "Id": "test8", "RecordTypeId": "RecordTypeId2", "CA10__disappearanceTime__c": null, "RecordType": { "DeveloperName": "caWebDistribution", "Id": "RecordTypeId2" }, "CA10__AWS_CloudFront_Origins__r": [] }, { "expectedResult": { "status": "UNDETERMINED", "conditionIndex": "499", "conditionText": "CA10__AWS_CloudFront_Origins__r.hasNo(INAPPLICABLE) && CA10__AWS_CloudFront_Origins__r.hasNo(UNDETERMINED)", "runtimeError": null }, "context": { "snapshotTime": "2025-07-06T16:27:09Z" }, "Id": "test9", "RecordTypeId": "RecordTypeId2", "CA10__disappearanceTime__c": null, "RecordType": { "DeveloperName": "caWebDistribution", "Id": "RecordTypeId2" }, "CA10__AWS_CloudFront_Origins__r": [ { "Id": "test9_1", "CA10__disappearanceTime__c": "2025-07-06T16:27:09Z", "CA10__configProtocolPolicy__c": "https-only", "CA10__domainName__c": "domainName9", "CA10__customOriginConfigOriginSslProtocols__c": "TLSv1.2", "CA10__distribution__c": "test9" } ] } ] - path: /types/CA10__CaAwsOrigin2__c/object.extracts.yaml md5Hash: A6C66AAA99283FB6BC69E96BB4DBAF65 content: "---\nextracts:\n# Values: http-only | match-viewer | https-only. Nullable.\ \ In case it's a Custom Origin, cannot be null. \n# Can't have no access, retrieved\ \ via cloudfront:GetDistribution.\n - name: \"CA10__configProtocolPolicy__c\"\ \n value:\n FIELD:\n path: CA10__configProtocolPolicy__c\n# Not\ \ Nullable. Can't have no access, retrieved via cloudfront:GetDistribution.\n\ \ - name: \"CA10__domainName__c\"\n value:\n FIELD:\n path:\ \ CA10__domainName__c\n undeterminedIf:\n isEmpty: \"Corrupted\ \ data. Origin Domain Name cannot be empty.\"\n# Values: SSLv3 | TLSv1 | TLSv1.1\ \ | TLSv1.2. Nullable. In case it's a Custom Origin, cannot be null. \n# Can't\ \ have no access, retrieved via cloudfront:GetDistribution.\n - name: \"CA10__customOriginConfigOriginSslProtocols__c\"\ \n value:\n FIELD:\n path: CA10__customOriginConfigOriginSslProtocols__c\n\ \ - name: caSetFrom__customOriginConfigOriginSslProtocols__c\n value:\n\ \ SET_FROM:\n separator: \"\\n\"\n arg:\n EXTRACT:\ \ \"CA10__customOriginConfigOriginSslProtocols__c\"" - path: /types/CA10__CaAwsCacheBehavior2__c/object.extracts.yaml md5Hash: 9FCFD18140FB8C38265EB37003668054 content: |- --- extracts: # Values: allow-all | https-only | redirect-to-https. Not Nullable. Can't have no access, retrieved via cloudfront:GetDistribution - name: "CA10__viewerProtocolPolicy__c" value: FIELD: path: CA10__viewerProtocolPolicy__c undeterminedIf: isEmpty: "Corrupted data. Viewer Protocol Policy cannot be empty." 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" : "INAPPLICABLE", "conditionIndex" : "199", "conditionText" : "not(setOfText(['caWebDistribution']).contains(RecordType.DeveloperName))", "runtimeError" : null } }, { "Id" : "test3", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "299", "conditionText" : "CA10__AWS_CloudFront_Origins__r.has(INCOMPLIANT)", "runtimeError" : null } }, { "Id" : "test4", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "399", "conditionText" : "CA10__AWS_CloudFront_Origins__r.has(COMPLIANT)", "runtimeError" : null } }, { "Id" : "test5", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "500", "conditionText" : "otherwise", "runtimeError" : null } }, { "Id" : "test6", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "500", "conditionText" : "otherwise", "runtimeError" : null } }, { "Id" : "test7", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "500", "conditionText" : "otherwise", "runtimeError" : null } }, { "Id" : "test8", "expectedResult" : { "status" : "UNDETERMINED", "conditionIndex" : "499", "conditionText" : "CA10__AWS_CloudFront_Origins__r.hasNo(INAPPLICABLE) && CA10__AWS_CloudFront_Origins__r.hasNo(UNDETERMINED)", "runtimeError" : null } }, { "Id" : "test9", "expectedResult" : { "status" : "UNDETERMINED", "conditionIndex" : "499", "conditionText" : "CA10__AWS_CloudFront_Origins__r.hasNo(INAPPLICABLE) && CA10__AWS_CloudFront_Origins__r.hasNo(UNDETERMINED)", "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"), "Id" : "test1", "RecordTypeId" : "RecordTypeId1" }, { "context" : { "snapshotTime" : new Date("2025-05-10T18:55:17Z") }, "Id" : "test2", "RecordTypeId" : "RecordTypeId1" }, { "context" : { "snapshotTime" : new Date("2025-07-06T16:27:09Z") }, "Id" : "test3", "RecordTypeId" : "RecordTypeId2" }, { "context" : { "snapshotTime" : new Date("2025-07-06T16:27:09Z") }, "Id" : "test4", "RecordTypeId" : "RecordTypeId2" }, { "context" : { "snapshotTime" : new Date("2025-07-06T16:27:09Z") }, "Id" : "test5", "RecordTypeId" : "RecordTypeId2" }, { "context" : { "snapshotTime" : new Date("2025-07-06T16:27:09Z") }, "Id" : "test6", "RecordTypeId" : "RecordTypeId2" }, { "context" : { "snapshotTime" : new Date("2025-07-06T16:27:09Z") }, "Id" : "test7", "RecordTypeId" : "RecordTypeId2" }, { "context" : { "snapshotTime" : new Date("2025-07-06T16:27:09Z") }, "Id" : "test8", "RecordTypeId" : "RecordTypeId2" }, { "context" : { "snapshotTime" : new Date("2025-07-06T16:27:09Z") }, "Id" : "test9", "RecordTypeId" : "RecordTypeId2" } ]; """; CREATE TEMP FUNCTION mock_RecordType() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-05-10T18:55:17Z") }, "DeveloperName" : "caRtmpDistribution", "Id" : "RecordTypeId1" }, { "context" : { "snapshotTime" : new Date("2025-07-06T16:27:09Z") }, "DeveloperName" : "caWebDistribution", "Id" : "RecordTypeId2" } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsOrigin2__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-07-06T16:27:09Z") }, "CA10__configProtocolPolicy__c" : "match-viewer", "CA10__domainName__c" : "domainName3", "CA10__customOriginConfigOriginSslProtocols__c" : "SSLv3\nTLSv1\nTLSv1.1\nTLSv1.2", "CA10__distribution__c" : "test3", "Id" : "test3_1" }, { "context" : { "snapshotTime" : new Date("2025-07-06T16:27:09Z") }, "CA10__configProtocolPolicy__c" : "https-only", "CA10__domainName__c" : "domainName4", "CA10__customOriginConfigOriginSslProtocols__c" : "TLSv1\nTLSv1.1\nTLSv1.2", "CA10__distribution__c" : "test4", "Id" : "test4_1" }, { "context" : { "snapshotTime" : new Date("2025-07-06T16:27:09Z") }, "CA10__configProtocolPolicy__c" : "", "CA10__domainName__c" : "domainName5", "CA10__customOriginConfigOriginSslProtocols__c" : "", "CA10__distribution__c" : "test5", "Id" : "test5_1" }, { "context" : { "snapshotTime" : new Date("2025-07-06T16:27:09Z") }, "CA10__configProtocolPolicy__c" : "https-only", "CA10__domainName__c" : "domainName6", "CA10__customOriginConfigOriginSslProtocols__c" : "TLSv1.2", "CA10__distribution__c" : "test6", "Id" : "test6_1" }, { "context" : { "snapshotTime" : new Date("2025-07-06T16:27:09Z") }, "CA10__configProtocolPolicy__c" : "https-only", "CA10__domainName__c" : "domainName7.s3-website-domainName7", "CA10__customOriginConfigOriginSslProtocols__c" : "TLSv1\nTLSv1.1\nTLSv1.2", "CA10__distribution__c" : "test7", "Id" : "test7_1" }, { "context" : { "snapshotTime" : new Date("2025-07-06T16:27:09Z") }, "CA10__disappearanceTime__c" : new Date("2025-07-06T16:27:09Z"), "CA10__configProtocolPolicy__c" : "https-only", "CA10__domainName__c" : "domainName9", "CA10__customOriginConfigOriginSslProtocols__c" : "TLSv1.2", "CA10__distribution__c" : "test9", "Id" : "test9_1" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsDistribution__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, RecordType STRUCT< DeveloperName STRING, Id STRING >, CA10__AWS_CloudFront_Origins__r ARRAY >>, Id STRING, RecordTypeId STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" var BytesLib = new function () { this.normalize = function(arg) { return arg == null ? '' : arg; }; this.isEmpty = function(arg) { return this.normalize(arg) == ''; }; this.isNotEmpty = function(arg) { return this.normalize(arg) != ''; }; this.equal = function(left, right) { return this.normalize(left) == this.normalize(right); }; this.notEqual = function(left, right) { return this.normalize(left) != this.normalize(right); }; this.startsWith = function(arg, substring) { return this.normalize(arg).startsWith(this.normalize(substring)); }; this.endsWith = function(arg, substring) { return this.normalize(arg).endsWith(this.normalize(substring)); }; this.contains = function(arg, substring) { return this.normalize(arg).includes(this.normalize(substring)); }; this.containsAll = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.every(sub => normalizedArg.includes(this.normalize(sub))); }; this.containsAny = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.some(sub => normalizedArg.includes(this.normalize(sub))); }; }(); var CollectionLib = new function () { this.parse = function(arg, separator, skipEmpty, skipDuplicates, sort, normalize) { if (arg == null) return []; let parts = arg.split(separator); return this.fromArray(parts, skipEmpty, skipDuplicates, sort, normalize); }; this.fromArray = function(arr, skipEmpty, skipDuplicates, sort, normalize) { if (arr == null) return []; let result = []; let seen = new Set(); arr.forEach(el => { let normalized = normalize ? TextLib.normalize(el) : BytesLib.normalize(el); if (!skipEmpty || (normalize ? TextLib.isNotEmpty(el) : BytesLib.isNotEmpty(el))) { if (!skipDuplicates || !seen.has(normalized)) { if (skipDuplicates) seen.add(normalized); result.push(normalized); } } }); if (sort) result.sort(); return result; }; this.equal = function(left, right) { left = left == null ? [] : left; right = right == null ? [] : right; if (left.length !== right.length) return false; for (let i = 0; i < left.length; i++) { if (left[i] !== right[i]) return false; } return true; }; this.notEqual = function(left, right) { return !this.equal(left, right); }; this.size = function(collection) { return collection == null ? 0 : collection.length; }; this.startsWith = function(collection, search, normalize) { if (collection == null || collection.length === 0) return false; let normalizedSearch = normalize ? TextLib.normalize(search) : BytesLib.normalize(search); return collection[0] === normalizedSearch; }; this.endsWith = function(collection, search, normalize) { if (collection == null || collection.length === 0) return false; let normalizedSearch = normalize ? TextLib.normalize(search) : BytesLib.normalize(search); return collection[collection.length - 1] === normalizedSearch; }; this.contains = function(collection, search, normalize) { if (collection == null || collection.length === 0) return false; return collection.includes(normalize ? TextLib.normalize(search) : BytesLib.normalize(search)); }; this.containsAll = function(collection, searchArray, normalize) { if (collection == null || collection.length === 0 || searchArray == null || searchArray.length === 0) return false; return searchArray.every(search => collection.includes(normalize ? TextLib.normalize(search) : BytesLib.normalize(search))); }; this.containsAny = function(collection, searchArray, normalize) { if (collection == null || collection.length === 0 || searchArray == null || searchArray.length === 0) return false; return searchArray.some(search => collection.includes(normalize ? TextLib.normalize(search) : BytesLib.normalize(search))); }; }(); var TextLib = new function () { this.normalize = function(arg) { return arg == null ? '' : arg.replace(/\s+/g, ' ').trim().toLowerCase(); }; this.isEmpty = function(arg) { return this.normalize(arg) == ''; }; this.isNotEmpty = function(arg) { return this.normalize(arg) != ''; }; this.equal = function(left, right) { return this.normalize(left) == this.normalize(right); }; this.notEqual = function(left, right) { return this.normalize(left) != this.normalize(right); }; this.startsWith = function(arg, substring) { return this.normalize(arg).startsWith(this.normalize(substring)); }; this.endsWith = function(arg, substring) { return this.normalize(arg).endsWith(this.normalize(substring)); }; this.contains = function(arg, substring) { return this.normalize(arg).includes(this.normalize(substring)); }; this.containsAll = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.every(sub => normalizedArg.includes(this.normalize(sub))); }; this.containsAny = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.some(sub => normalizedArg.includes(this.normalize(sub))); }; }(); 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] references1.push('Record Type Name [obj.RecordType.DeveloperName]: ' + obj.RecordType.DeveloperName); if (!CollectionLib.contains(CollectionLib.fromArray(['caWebDistribution'], true, true, true, true), obj.RecordType.DeveloperName, true)) { return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "not(setOfText(['caWebDistribution']).contains(RecordType.DeveloperName))", currentStateMessage: "Object record type is not applicable", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } var count_CA10__AWS_CloudFront_Origins__r_INCOMPLIANT3 = 0; if (obj.CA10__AWS_CloudFront_Origins__r != null) { for (var i4 = 0; i4 < obj.CA10__AWS_CloudFront_Origins__r.length; i4++) { if (typeof(obj.CA10__AWS_CloudFront_Origins__r[i4].status) !== 'undefined') { if (obj.CA10__AWS_CloudFront_Origins__r[i4].status == 'INCOMPLIANT') { count_CA10__AWS_CloudFront_Origins__r_INCOMPLIANT3 += obj.CA10__AWS_CloudFront_Origins__r[i4].count; } } else { if (obj.CA10__AWS_CloudFront_Origins__r[i4].result.status == 'INCOMPLIANT') { count_CA10__AWS_CloudFront_Origins__r_INCOMPLIANT3 += 1; } } } } // condition[2], conditionIndex:[200..299] references1.push('Related list [CA10__AWS_CloudFront_Origins__r] ' + (count_CA10__AWS_CloudFront_Origins__r_INCOMPLIANT3 > 0 ? 'has' : 'does not have') + ' objects in INCOMPLIANT status'); if (count_CA10__AWS_CloudFront_Origins__r_INCOMPLIANT3 > 0) { return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "CA10__AWS_CloudFront_Origins__r.has(INCOMPLIANT)", currentStateMessage: "The distribution has at least one custom origin that uses the deprecated SSL 3.0 protocol.", currentStateReferences: references1.join('\n'), remediation: "Update the minimum origin SSL protocol to TLSv1.2 or later.", runtimeError: null}; } var count_CA10__AWS_CloudFront_Origins__r_COMPLIANT5 = 0; if (obj.CA10__AWS_CloudFront_Origins__r != null) { for (var i6 = 0; i6 < obj.CA10__AWS_CloudFront_Origins__r.length; i6++) { if (typeof(obj.CA10__AWS_CloudFront_Origins__r[i6].status) !== 'undefined') { if (obj.CA10__AWS_CloudFront_Origins__r[i6].status == 'COMPLIANT') { count_CA10__AWS_CloudFront_Origins__r_COMPLIANT5 += obj.CA10__AWS_CloudFront_Origins__r[i6].count; } } else { if (obj.CA10__AWS_CloudFront_Origins__r[i6].result.status == 'COMPLIANT') { count_CA10__AWS_CloudFront_Origins__r_COMPLIANT5 += 1; } } } } // condition[3], conditionIndex:[300..399] if (count_CA10__AWS_CloudFront_Origins__r_COMPLIANT5 > 0) { return {status: 'INCOMPLIANT', conditionIndex: 399, conditionText: "CA10__AWS_CloudFront_Origins__r.has(COMPLIANT)", currentStateMessage: "The distribution has at least one custom origin that uses the outdated TLS protocols.", currentStateReferences: references1.join('\n'), remediation: "Update the minimum origin SSL protocol to TLSv1.2 or later.", runtimeError: null}; } var count_CA10__AWS_CloudFront_Origins__r_UNDETERMINED8 = 0; var count_CA10__AWS_CloudFront_Origins__r_INAPPLICABLE7 = 0; if (obj.CA10__AWS_CloudFront_Origins__r != null) { for (var i9 = 0; i9 < obj.CA10__AWS_CloudFront_Origins__r.length; i9++) { if (typeof(obj.CA10__AWS_CloudFront_Origins__r[i9].status) !== 'undefined') { if (obj.CA10__AWS_CloudFront_Origins__r[i9].status == 'UNDETERMINED') { count_CA10__AWS_CloudFront_Origins__r_UNDETERMINED8 += obj.CA10__AWS_CloudFront_Origins__r[i9].count; } } else { if (obj.CA10__AWS_CloudFront_Origins__r[i9].result.status == 'UNDETERMINED') { count_CA10__AWS_CloudFront_Origins__r_UNDETERMINED8 += 1; } } if (typeof(obj.CA10__AWS_CloudFront_Origins__r[i9].status) !== 'undefined') { if (obj.CA10__AWS_CloudFront_Origins__r[i9].status == 'INAPPLICABLE') { count_CA10__AWS_CloudFront_Origins__r_INAPPLICABLE7 += obj.CA10__AWS_CloudFront_Origins__r[i9].count; } } else { if (obj.CA10__AWS_CloudFront_Origins__r[i9].result.status == 'INAPPLICABLE') { count_CA10__AWS_CloudFront_Origins__r_INAPPLICABLE7 += 1; } } } } // condition[4], conditionIndex:[400..499] if (count_CA10__AWS_CloudFront_Origins__r_INAPPLICABLE7 == 0 && count_CA10__AWS_CloudFront_Origins__r_UNDETERMINED8 == 0) { return {status: 'UNDETERMINED', conditionIndex: 499, conditionText: "CA10__AWS_CloudFront_Origins__r.hasNo(INAPPLICABLE) && CA10__AWS_CloudFront_Origins__r.hasNo(UNDETERMINED)", currentStateMessage: "The distribution doesn't have any origins in the CMDB.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'COMPLIANT', conditionIndex: 500, conditionText: "otherwise", currentStateMessage: "All custom origins for this distribution are configured to use TLSv1.2 or later SSL protocols (if applicable).", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; """; CREATE TEMP FUNCTION process_CA10__AWS_CloudFront_Origins__r( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__configProtocolPolicy__c STRING, CA10__domainName__c STRING, CA10__customOriginConfigOriginSslProtocols__c STRING, CA10__distribution__c STRING, Id STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" var BytesLib = new function () { this.normalize = function(arg) { return arg == null ? '' : arg; }; this.isEmpty = function(arg) { return this.normalize(arg) == ''; }; this.isNotEmpty = function(arg) { return this.normalize(arg) != ''; }; this.equal = function(left, right) { return this.normalize(left) == this.normalize(right); }; this.notEqual = function(left, right) { return this.normalize(left) != this.normalize(right); }; this.startsWith = function(arg, substring) { return this.normalize(arg).startsWith(this.normalize(substring)); }; this.endsWith = function(arg, substring) { return this.normalize(arg).endsWith(this.normalize(substring)); }; this.contains = function(arg, substring) { return this.normalize(arg).includes(this.normalize(substring)); }; this.containsAll = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.every(sub => normalizedArg.includes(this.normalize(sub))); }; this.containsAny = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.some(sub => normalizedArg.includes(this.normalize(sub))); }; }(); var CollectionLib = new function () { this.parse = function(arg, separator, skipEmpty, skipDuplicates, sort, normalize) { if (arg == null) return []; let parts = arg.split(separator); return this.fromArray(parts, skipEmpty, skipDuplicates, sort, normalize); }; this.fromArray = function(arr, skipEmpty, skipDuplicates, sort, normalize) { if (arr == null) return []; let result = []; let seen = new Set(); arr.forEach(el => { let normalized = normalize ? TextLib.normalize(el) : BytesLib.normalize(el); if (!skipEmpty || (normalize ? TextLib.isNotEmpty(el) : BytesLib.isNotEmpty(el))) { if (!skipDuplicates || !seen.has(normalized)) { if (skipDuplicates) seen.add(normalized); result.push(normalized); } } }); if (sort) result.sort(); return result; }; this.equal = function(left, right) { left = left == null ? [] : left; right = right == null ? [] : right; if (left.length !== right.length) return false; for (let i = 0; i < left.length; i++) { if (left[i] !== right[i]) return false; } return true; }; this.notEqual = function(left, right) { return !this.equal(left, right); }; this.size = function(collection) { return collection == null ? 0 : collection.length; }; this.startsWith = function(collection, search, normalize) { if (collection == null || collection.length === 0) return false; let normalizedSearch = normalize ? TextLib.normalize(search) : BytesLib.normalize(search); return collection[0] === normalizedSearch; }; this.endsWith = function(collection, search, normalize) { if (collection == null || collection.length === 0) return false; let normalizedSearch = normalize ? TextLib.normalize(search) : BytesLib.normalize(search); return collection[collection.length - 1] === normalizedSearch; }; this.contains = function(collection, search, normalize) { if (collection == null || collection.length === 0) return false; return collection.includes(normalize ? TextLib.normalize(search) : BytesLib.normalize(search)); }; this.containsAll = function(collection, searchArray, normalize) { if (collection == null || collection.length === 0 || searchArray == null || searchArray.length === 0) return false; return searchArray.every(search => collection.includes(normalize ? TextLib.normalize(search) : BytesLib.normalize(search))); }; this.containsAny = function(collection, searchArray, normalize) { if (collection == null || collection.length === 0 || searchArray == null || searchArray.length === 0) return false; return searchArray.some(search => collection.includes(normalize ? TextLib.normalize(search) : BytesLib.normalize(search))); }; }(); var TextLib = new function () { this.normalize = function(arg) { return arg == null ? '' : arg.replace(/\s+/g, ' ').trim().toLowerCase(); }; this.isEmpty = function(arg) { return this.normalize(arg) == ''; }; this.isNotEmpty = function(arg) { return this.normalize(arg) != ''; }; this.equal = function(left, right) { return this.normalize(left) == this.normalize(right); }; this.notEqual = function(left, right) { return this.normalize(left) != this.normalize(right); }; this.startsWith = function(arg, substring) { return this.normalize(arg).startsWith(this.normalize(substring)); }; this.endsWith = function(arg, substring) { return this.normalize(arg).endsWith(this.normalize(substring)); }; this.contains = function(arg, substring) { return this.normalize(arg).includes(this.normalize(substring)); }; this.containsAll = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.every(sub => normalizedArg.includes(this.normalize(sub))); }; this.containsAny = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.some(sub => normalizedArg.includes(this.normalize(sub))); }; }(); 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__configProtocolPolicy__c; } return this.out; }; references1.push('Custom Origin Config Protocol Policy [obj.CA10__configProtocolPolicy__c]: ' + obj.CA10__configProtocolPolicy__c); if (TextLib.isEmpty(extract3.call(extract3))) { return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "extract('CA10__configProtocolPolicy__c').isEmpty()", currentStateMessage: "This is not a custom origin.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[2], conditionIndex:[200..299] function extract6() { if (!this.out) { this.out = obj.CA10__configProtocolPolicy__c; } return this.out; }; if (TextLib.equal(extract6.call(extract6), 'http-only')) { return {status: 'INAPPLICABLE', conditionIndex: 299, conditionText: "extract('CA10__configProtocolPolicy__c') == 'http-only'", currentStateMessage: "The protocol policy for this custom origin is http-only.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[3], conditionIndex:[300..399] function fieldChecked10() { if (TextLib.isEmpty(obj.CA10__domainName__c)) { throw new Error("UNDETERMINED condition:301", {cause: {status: 'UNDETERMINED', conditionIndex: 301, conditionText: "CA10__domainName__c.isEmpty()", currentStateMessage: "Corrupted data. Origin Domain Name cannot be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__domainName__c; } function extract9() { if (!this.out) { this.out = fieldChecked10(); } return this.out; }; references1.push('Domain Name [obj.CA10__domainName__c]: ' + obj.CA10__domainName__c); try { if (TextLib.contains(extract9.call(extract9), 's3-website')) { return {status: 'INAPPLICABLE', conditionIndex: 399, conditionText: "extract('CA10__domainName__c').contains('s3-website')", currentStateMessage: "This origin is an S3 bucket configured for static website hosting, which does not support HTTPS.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[4], conditionIndex:[400..499] function extract14() { if (!this.out) { this.out = obj.CA10__customOriginConfigOriginSslProtocols__c; } return this.out; }; function extract12() { if (!this.out) { this.out = CollectionLib.parse(extract14.call(extract14), '\n', true, true, true, true); } return this.out; }; references1.push('Custom Origin Config Origin SSL Protocol [obj.CA10__customOriginConfigOriginSslProtocols__c]: ' + obj.CA10__customOriginConfigOriginSslProtocols__c); if (CollectionLib.contains(extract12.call(extract12), 'SSLv3', true)) { return {status: 'INCOMPLIANT', conditionIndex: 499, conditionText: "extract('caSetFrom__customOriginConfigOriginSslProtocols__c').contains('SSLv3')", currentStateMessage: "The distribution allows the deprecated SSL 3.0 protocol.", currentStateReferences: references1.join('\n'), remediation: "Use TLSv1.2 or later for HTTPS communication to the origin.", runtimeError: null}; } // condition[5], conditionIndex:[500..599] function extract20() { if (!this.out) { this.out = obj.CA10__customOriginConfigOriginSslProtocols__c; } return this.out; }; function extract18() { if (!this.out) { this.out = CollectionLib.parse(extract20.call(extract20), '\n', true, true, true, true); } return this.out; }; if (CollectionLib.containsAny(extract18.call(extract18), CollectionLib.fromArray(['TLSv1.1', 'TLSv1'], true, true, true, true), true)) { return {status: 'COMPLIANT', conditionIndex: 599, conditionText: "extract('caSetFrom__customOriginConfigOriginSslProtocols__c').containsAny(setOfText(['TLSv1.1', 'TLSv1']))", currentStateMessage: "The distribution allows the outdated TLS protocols.", currentStateReferences: references1.join('\n'), remediation: "Use TLSv1.2 or later for HTTPS communication to the origin.", runtimeError: null}; } return {status: 'UNDETERMINED', conditionIndex: 600, conditionText: "otherwise", currentStateMessage: "The Minimum Origin SSL protocol enforces TLSv1.2 or later.", 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, STRUCT ( `RecordType`.DeveloperName AS DeveloperName, `RecordType`.Id AS Id ) AS RecordType, `CA10__AWS_CloudFront_Origins__r`.arr AS CA10__AWS_CloudFront_Origins__r, sObject.Id AS Id, sObject.RecordTypeId AS RecordTypeId, process_CA10__CaAwsDistribution__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, STRUCT ( `RecordType`.DeveloperName AS DeveloperName, `RecordType`.Id AS Id ) AS RecordType, `CA10__AWS_CloudFront_Origins__r`.arr AS CA10__AWS_CloudFront_Origins__r, sObject.Id AS Id, sObject.RecordTypeId AS RecordTypeId ), 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 LEFT JOIN ( SELECT sObject.CA10__distribution__c, ARRAY_AGG( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__configProtocolPolicy__c AS CA10__configProtocolPolicy__c, sObject.CA10__domainName__c AS CA10__domainName__c, sObject.CA10__customOriginConfigOriginSslProtocols__c AS CA10__customOriginConfigOriginSslProtocols__c, sObject.CA10__distribution__c AS CA10__distribution__c, sObject.Id AS Id, process_CA10__AWS_CloudFront_Origins__r( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__configProtocolPolicy__c AS CA10__configProtocolPolicy__c, sObject.CA10__domainName__c AS CA10__domainName__c, sObject.CA10__customOriginConfigOriginSslProtocols__c AS CA10__customOriginConfigOriginSslProtocols__c, sObject.CA10__distribution__c AS CA10__distribution__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result ) ) AS arr FROM UNNEST(mock_CA10__CaAwsOrigin2__c()) AS sObject GROUP BY sObject.CA10__distribution__c ) AS `CA10__AWS_CloudFront_Origins__r` ON sObject.Id = `CA10__AWS_CloudFront_Origins__r`.CA10__distribution__c ) sObject ON sObject.Id = expectedResult.Id;