--- policy: /ce/ca/aws/efs/file-system-cmk-encryption logic: /ce/ca/aws/efs/file-system-cmk-encryption/prod.logic.yaml executionTime: 2026-06-06T12:02:51.110501889Z generationMs: 58 executionMs: 993 rows: - id: '001' match: true status: expected: INAPPLICABLE actual: INAPPLICABLE conditionIndex: expected: 199 actual: 199 conditionText: expected: not(extract('CA10__encrypted__c')) actual: not(extract('CA10__encrypted__c')) runtimeError: {} - id: '002' match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 299 actual: 299 conditionText: expected: isEmptyLookup('CA10__kmsKey__r') actual: isEmptyLookup('CA10__kmsKey__r') runtimeError: {} - id: '003' match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 399 actual: 399 conditionText: expected: extract('CA10__kmsKey__r.CA10__manager__c') != 'CUSTOMER' actual: extract('CA10__kmsKey__r.CA10__manager__c') != 'CUSTOMER' runtimeError: {} - id: '004' match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 499 actual: 499 conditionText: expected: extract('CA10__encrypted__c') == true && extract('CA10__kmsKey__r.CA10__manager__c') == 'CUSTOMER' actual: extract('CA10__encrypted__c') == true && extract('CA10__kmsKey__r.CA10__manager__c') == 'CUSTOMER' runtimeError: {} usedFiles: - path: /ce/ca/aws/efs/file-system-cmk-encryption/policy.yaml md5Hash: 9BFD36FB13AFBEDDE37FBE84ECC18E5F content: "---\nnames:\n full: \"AWS EFS File System is not encrypted with KMS\ \ CMK\"\n contextual: \"File System is not encrypted with KMS Customer Master\ \ Key\"\ndescription: >\n Ensure that your Amazon EFS file systems are encrypted\ \ using KMS customer-managed keys instead of \n AWS managed-keys (default keys\ \ used by the EFS service when there are no customer keys defined). \n Using\ \ a CMK provides additional control over key rotation, access policies, \n \ \ and auditing compared to the default AWS-managed key.\ntype: COMPLIANCE_POLICY\n\ categories:\n - SECURITY\nframeworkMappings:\n - \"/frameworks/cloudaware/resource-security/data-encryption\"\ \n - \"/frameworks/aws-fsbp-v1.0.0/efs/01\"\n - \"/frameworks/aws-well-architected/sec/08/02\"\ \nsimilarPolicies:\n awsSecurityHub:\n - name: \"[EFS.1] Elastic File System\ \ should be configured to encrypt file data at-rest using AWS KMS\"\n url:\ \ \"https://docs.aws.amazon.com/securityhub/latest/userguide/efs-controls.html#efs-1\"\ \n cloudConformity:\n - url: \"https://www.trendmicro.com/cloudoneconformity/knowledge-base/aws/EFS/efs-encrypted-with-kms-customer-master-keys.html\"\ \n name: AWS KMS Customer Master Keys for EFS Encryption\n" - path: /ce/ca/aws/efs/file-system-cmk-encryption/prod.logic.yaml md5Hash: 6A7530872639A99936D53330EB9DA3F2 content: | --- inputType: "CA10__CaAwsEfsFileSystem__c" testData: - file: test-data.json importExtracts: - file: "/types/CA10__CaAwsEfsFileSystem__c/object.extracts.yaml" - file: "/types/CA10__CaAwsKmsKey__c/object.extracts.yaml" conditions: - status: "INAPPLICABLE" currentStateMessage: "The EFS file system is not encrypted with any key. This is addressed in the file-system-encryption policy." check: NOT: arg: EXTRACT: "CA10__encrypted__c" - status: "INCOMPLIANT" currentStateMessage: "The EFS file system is not encrypted using a KMS key." remediationMessage: "Enable KMS customer-managed key encryption for the EFS file system." check: IS_EMPTY_LOOKUP: CA10__kmsKey__r - status: "INCOMPLIANT" currentStateMessage: "The EFS file system is not encrypted using a KMS customer-managed key." remediationMessage: "Enable KMS customer-managed key encryption for the EFS file system." check: NOT_EQUAL: left: EXTRACT: "CA10__kmsKey__r.CA10__manager__c" right: TEXT: 'CUSTOMER' - status: "COMPLIANT" currentStateMessage: "The EFS file system is encrypted using a KMS customer-managed key." check: AND: args: - IS_EQUAL: left: EXTRACT: "CA10__encrypted__c" right: BOOLEAN: true - IS_EQUAL: left: EXTRACT: "CA10__kmsKey__r.CA10__manager__c" right: TEXT: 'CUSTOMER' otherwise: status: "UNDETERMINED" currentStateMessage: "Unexpected values in the field." - path: /ce/ca/aws/efs/file-system-cmk-encryption/test-data.json md5Hash: C2628736D35D3F86B64BA5A93840ADDF content: | [ { "expectedResult": { "status": "INAPPLICABLE", "conditionIndex": "199", "conditionText": "not(extract('CA10__encrypted__c'))", "runtimeError": null }, "context": { "snapshotTime": "2025-12-01T00:50:53Z" }, "CA10__disappearanceTime__c": null, "CA10__encrypted__c": false, "CA10__kmsKey__c": "", "CA10__kmsKeyArn__c": "", "Id": "001", "CA10__kmsKey__r": { "Id": null, "CA10__disappearanceTime__c": null, "CA10__manager__c": null } }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "299", "conditionText": "isEmptyLookup('CA10__kmsKey__r')", "runtimeError": null }, "context": { "snapshotTime": "2025-12-01T00:50:53Z" }, "CA10__disappearanceTime__c": null, "CA10__encrypted__c": true, "CA10__kmsKey__c": "", "CA10__kmsKeyArn__c": "", "Id": "002", "CA10__kmsKey__r": { "Id": null, "CA10__disappearanceTime__c": null, "CA10__manager__c": null } }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "399", "conditionText": "extract('CA10__kmsKey__r.CA10__manager__c') != 'CUSTOMER'", "runtimeError": null }, "context": { "snapshotTime": "2025-12-01T00:50:53Z" }, "CA10__disappearanceTime__c": null, "CA10__encrypted__c": true, "CA10__kmsKey__c": "key003", "CA10__kmsKeyArn__c": "arn:aws:kms:us-east-1:33333:key/3", "Id": "003", "CA10__kmsKey__r": { "Id": "key003", "CA10__disappearanceTime__c": null, "CA10__manager__c": "AWS" } }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "499", "conditionText": "extract('CA10__encrypted__c') == true && extract('CA10__kmsKey__r.CA10__manager__c') == 'CUSTOMER'", "runtimeError": null }, "context": { "snapshotTime": "2025-12-01T00:50:53Z" }, "CA10__disappearanceTime__c": null, "CA10__encrypted__c": true, "CA10__kmsKey__c": "key004", "CA10__kmsKeyArn__c": "arn:aws:kms:us-east-1:44444:key/f4", "Id": "004", "CA10__kmsKey__r": { "Id": "key004", "CA10__disappearanceTime__c": null, "CA10__manager__c": "CUSTOMER" } } ] - path: /types/CA10__CaAwsKmsKey__c/object.extracts.yaml md5Hash: EC6D0EFD0BFEAB3447A84529724D4AFE content: "---\nextracts:\n# Values: Creating, Enabled, Disabled, PendingDeletion,\ \ PendingImport, PendingReplicaDeletion, Unavailable, Updating. Not nullable.\n\ \ - name: \"CA10__state__c\"\n value: \n FIELD:\n path: \"CA10__state__c\"\ \n undeterminedIf:\n noAccessDelegate: \n path: \"\ CA10__state__c\"\n currentStateMessage: \"Unable to determine Key\ \ state. Possible permission issue with kms:DescribeKey.\"\n isEmpty:\ \ \"KMS Key state is not populated yet.\"\n# Values: RSA_2048, RSA_3072, RSA_4096,\ \ ECC_NIST_P256, ECC_NIST_P384, ECC_NIST_P521, ECC_SECG_P256K1, SYMMETRIC_DEFAULT,\ \ HMAC_224, HMAC_256, HMAC_384, HMAC_512, SM2\n# Not nullable\n - name: \"\ CA10__keySpec__c\"\n value: \n FIELD:\n path: \"CA10__keySpec__c\"\ \n undeterminedIf:\n noAccessDelegate: \n path: \"\ CA10__keySpec__c\"\n currentStateMessage: \"Unable to determine Key\ \ state. Possible permission issue with kms:DescribeKey.\"\n isEmpty:\ \ \"KMS Key state is not populated yet.\"\n# Checkbox.\n - name: \"CA10__rotationEnabled__c\"\ \n value: \n FIELD:\n path: \"CA10__rotationEnabled__c\"\n \ \ undeterminedIf:\n noAccessDelegate:\n path: \"CA10__rotationEnabled__c\"\ \n currentStateMessage: \"Unable to determine Key Rotation status.\ \ Possible permission issue with kms:GetKeyRotationStatus.\"\n# Nullable.\n\ \ - name: \"CA10__deletionDate__c\"\n value: \n FIELD:\n path:\ \ \"CA10__deletionDate__c\"\n# Values: AWS | Customer. Not Nullable.\n - name:\ \ \"CA10__manager__c\"\n value: \n FIELD:\n path: \"CA10__manager__c\"\ \n undeterminedIf:\n noAccessDelegate: \n path: \"\ CA10__manager__c\"\n currentStateMessage: \"Unable to determine Key\ \ Manager. Possible permission issue with kms:DescribeKey.\"\n" - path: /types/CA10__CaAwsEfsFileSystem__c/object.extracts.yaml md5Hash: 3C7626729E41425BAD13D04E544D0213 content: "---\nextracts:\n# Boolean attribute\n - name: CA10__encrypted__c\n\ \ value: \n FIELD:\n path: CA10__encrypted__c\n" script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "001", "expectedResult" : { "status" : "INAPPLICABLE", "conditionIndex" : "199", "conditionText" : "not(extract('CA10__encrypted__c'))", "runtimeError" : null } }, { "Id" : "002", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "299", "conditionText" : "isEmptyLookup('CA10__kmsKey__r')", "runtimeError" : null } }, { "Id" : "003", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "399", "conditionText" : "extract('CA10__kmsKey__r.CA10__manager__c') != 'CUSTOMER'", "runtimeError" : null } }, { "Id" : "004", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "499", "conditionText" : "extract('CA10__encrypted__c') == true && extract('CA10__kmsKey__r.CA10__manager__c') == 'CUSTOMER'", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsEfsFileSystem__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-12-01T00:50:53Z") }, "CA10__encrypted__c" : false, "CA10__kmsKey__c" : "", "CA10__kmsKeyArn__c" : "", "Id" : "001" }, { "context" : { "snapshotTime" : new Date("2025-12-01T00:50:53Z") }, "CA10__encrypted__c" : true, "CA10__kmsKey__c" : "", "CA10__kmsKeyArn__c" : "", "Id" : "002" }, { "context" : { "snapshotTime" : new Date("2025-12-01T00:50:53Z") }, "CA10__encrypted__c" : true, "CA10__kmsKey__c" : "key003", "CA10__kmsKeyArn__c" : "arn:aws:kms:us-east-1:33333:key/3", "Id" : "003" }, { "context" : { "snapshotTime" : new Date("2025-12-01T00:50:53Z") }, "CA10__encrypted__c" : true, "CA10__kmsKey__c" : "key004", "CA10__kmsKeyArn__c" : "arn:aws:kms:us-east-1:44444:key/f4", "Id" : "004" } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsKmsKey__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-12-01T00:50:53Z") }, "Id" : null, "CA10__manager__c" : null }, { "context" : { "snapshotTime" : new Date("2025-12-01T00:50:53Z") }, "Id" : "key003", "CA10__manager__c" : "AWS" }, { "context" : { "snapshotTime" : new Date("2025-12-01T00:50:53Z") }, "Id" : "key004", "CA10__manager__c" : "CUSTOMER" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsEfsFileSystem__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__encrypted__c BOOLEAN, CA10__kmsKey__r STRUCT< Id STRING, CA10__disappearanceTime__c TIMESTAMP, CA10__manager__c STRING >, CA10__kmsKey__c STRING, CA10__kmsKeyArn__c STRING, Id STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" 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__encrypted__c; } return this.out; }; references1.push('Encrypted [obj.CA10__encrypted__c]: ' + obj.CA10__encrypted__c); if (!extract3.call(extract3)) { return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "not(extract('CA10__encrypted__c'))", currentStateMessage: "The EFS file system is not encrypted with any key. This is addressed in the file-system-encryption policy.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[2], conditionIndex:[200..299] if (TextLib.isEmpty(obj.CA10__kmsKeyArn__c) || TextLib.isEmpty(obj.CA10__kmsKey__c) || obj.CA10__kmsKey__r.CA10__disappearanceTime__c != null) { return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "isEmptyLookup('CA10__kmsKey__r')", currentStateMessage: "The EFS file system is not encrypted using a KMS key.", currentStateReferences: references1.join('\n'), remediation: "Enable KMS customer-managed key encryption for the EFS file system.", runtimeError: null}; } // condition[3], conditionIndex:[300..399] function extractChecked5() { if (TextLib.isEmpty(obj.CA10__kmsKeyArn__c)) { throw new Error("UNDETERMINED condition:301", {cause: {status: 'UNDETERMINED', conditionIndex: 301, conditionText: "extractCheck(obj.CA10__kmsKeyArn__c)", currentStateMessage: "Related object via CA10__kmsKeyArn__c has empty ID", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } if (TextLib.isEmpty(obj.CA10__kmsKey__c)) { throw new Error("UNDETERMINED condition:302", {cause: {status: 'UNDETERMINED', conditionIndex: 302, conditionText: "extractCheck(obj.CA10__kmsKey__c)", currentStateMessage: "Related object via CA10__kmsKey__c is not present", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } if (obj.CA10__kmsKey__r.CA10__disappearanceTime__c != null) { throw new Error("UNDETERMINED condition:303", {cause: {status: 'UNDETERMINED', conditionIndex: 303, conditionText: "extractCheck(obj.CA10__kmsKey__r.CA10__disappearanceTime__c)", currentStateMessage: "Related object via CA10__kmsKey__c is present, but deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return extract6.call(extract6); } function fieldChecked7() { if (TextLib.isEmpty(obj.CA10__kmsKey__r.CA10__manager__c)) { throw new Error("UNDETERMINED condition:304", {cause: {status: 'UNDETERMINED', conditionIndex: 304, conditionText: "CA10__manager__c.delegatedTo(CA10__manager__c).isEmpty()", currentStateMessage: "Unable to determine Key Manager. Possible permission issue with kms:DescribeKey.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__kmsKey__r.CA10__manager__c; } function extract6() { if (!this.out) { this.out = fieldChecked7(); } return this.out; }; references1.push('Manager [obj.CA10__kmsKey__r.CA10__manager__c]: ' + obj.CA10__kmsKey__r.CA10__manager__c); try { if (TextLib.notEqual(extractChecked5(), 'CUSTOMER')) { return {status: 'INCOMPLIANT', conditionIndex: 399, conditionText: "extract('CA10__kmsKey__r.CA10__manager__c') != 'CUSTOMER'", currentStateMessage: "The EFS file system is not encrypted using a KMS customer-managed key.", currentStateReferences: references1.join('\n'), remediation: "Enable KMS customer-managed key encryption for the EFS file system.", runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[4], conditionIndex:[400..499] function extract9() { if (!this.out) { this.out = obj.CA10__encrypted__c; } return this.out; }; function extractChecked11() { if (TextLib.isEmpty(obj.CA10__kmsKeyArn__c)) { throw new Error("UNDETERMINED condition:401", {cause: {status: 'UNDETERMINED', conditionIndex: 401, conditionText: "extractCheck(obj.CA10__kmsKeyArn__c)", currentStateMessage: "Related object via CA10__kmsKeyArn__c has empty ID", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } if (TextLib.isEmpty(obj.CA10__kmsKey__c)) { throw new Error("UNDETERMINED condition:402", {cause: {status: 'UNDETERMINED', conditionIndex: 402, conditionText: "extractCheck(obj.CA10__kmsKey__c)", currentStateMessage: "Related object via CA10__kmsKey__c is not present", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } if (obj.CA10__kmsKey__r.CA10__disappearanceTime__c != null) { throw new Error("UNDETERMINED condition:403", {cause: {status: 'UNDETERMINED', conditionIndex: 403, conditionText: "extractCheck(obj.CA10__kmsKey__r.CA10__disappearanceTime__c)", currentStateMessage: "Related object via CA10__kmsKey__c is present, but deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return extract12.call(extract12); } function fieldChecked13() { if (TextLib.isEmpty(obj.CA10__kmsKey__r.CA10__manager__c)) { throw new Error("UNDETERMINED condition:404", {cause: {status: 'UNDETERMINED', conditionIndex: 404, conditionText: "CA10__manager__c.delegatedTo(CA10__manager__c).isEmpty()", currentStateMessage: "Unable to determine Key Manager. Possible permission issue with kms:DescribeKey.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__kmsKey__r.CA10__manager__c; } function extract12() { if (!this.out) { this.out = fieldChecked13(); } return this.out; }; try { if (extract9.call(extract9) == true && TextLib.equal(extractChecked11(), 'CUSTOMER')) { return {status: 'COMPLIANT', conditionIndex: 499, conditionText: "extract('CA10__encrypted__c') == true && extract('CA10__kmsKey__r.CA10__manager__c') == 'CUSTOMER'", currentStateMessage: "The EFS file system is encrypted using a KMS customer-managed key.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } return {status: 'UNDETERMINED', conditionIndex: 500, 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__encrypted__c AS CA10__encrypted__c, STRUCT ( `CA10__kmsKey__r`.Id AS Id, `CA10__kmsKey__r`.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, `CA10__kmsKey__r`.CA10__manager__c AS CA10__manager__c ) AS CA10__kmsKey__r, sObject.CA10__kmsKey__c AS CA10__kmsKey__c, sObject.CA10__kmsKeyArn__c AS CA10__kmsKeyArn__c, sObject.Id AS Id, process_CA10__CaAwsEfsFileSystem__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__encrypted__c AS CA10__encrypted__c, STRUCT ( `CA10__kmsKey__r`.Id AS Id, `CA10__kmsKey__r`.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, `CA10__kmsKey__r`.CA10__manager__c AS CA10__manager__c ) AS CA10__kmsKey__r, sObject.CA10__kmsKey__c AS CA10__kmsKey__c, sObject.CA10__kmsKeyArn__c AS CA10__kmsKeyArn__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAwsEfsFileSystem__c()) AS sObject LEFT JOIN UNNEST(mock_CA10__CaAwsKmsKey__c()) AS `CA10__kmsKey__r` ON sObject.CA10__kmsKey__c = `CA10__kmsKey__r`.Id ) sObject ON sObject.Id = expectedResult.Id;