--- policy: /ce/ca/aws/lambda/function-tracing logic: /ce/ca/aws/lambda/function-tracing/prod.logic.yaml executionTime: 2026-02-10T22:33:03.867370463Z generationMs: 90 executionMs: 881 rows: - id: '001' 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: '002' match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 199 actual: 199 conditionText: expected: extract('CA10__tracingConfigResponseMode__c') == 'PassThrough' actual: extract('CA10__tracingConfigResponseMode__c') == 'PassThrough' runtimeError: {} - id: '003' match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 299 actual: 299 conditionText: expected: extract('CA10__tracingConfigResponseMode__c') == 'Active' actual: extract('CA10__tracingConfigResponseMode__c') == 'Active' runtimeError: {} usedFiles: - path: /ce/ca/aws/lambda/function-tracing/policy.yaml md5Hash: 84B8992D67F8BCFD3BF73DA5205988E0 content: "---\nnames:\n full: \"AWS Lambda Function X-Ray Tracing is not enabled\"\ \n contextual: \"Function X-Ray Tracing is not enabled\"\ndescription: >\n\ \ Ensure that AWS X-Ray active tracing is enabled for Lambda functions. X-Ray\ \ provides \n visibility into the execution of your function, helping you identify\ \ performance \n bottlenecks and troubleshoot issues in distributed applications.\n\ type: \"COMPLIANCE_POLICY\"\ncategories:\n - \"RELIABILITY\"\nframeworkMappings:\n\ \ - \"/frameworks/cloudaware/resource-reliability/system-configuration\"\n\ \ - \"/frameworks/nist-sp-800-53-r5/ca/07\"\nsimilarPolicies:\n cloudConformity:\n\ \ - url: https://www.trendmicro.com/cloudoneconformity/knowledge-base/aws/Lambda/tracing.html\n\ \ name: Tracing Enabled\n awsSecurityHub:\n - name: \"[Lambda.7] Lambda\ \ functions should have AWS X-Ray active tracing enabled\"\n url: \"https://docs.aws.amazon.com/securityhub/latest/userguide/lambda-controls.html#lambda-7\"" - path: /ce/ca/aws/lambda/function-tracing/prod.logic.yaml md5Hash: B64785DC46A209125537F0A884B4BEAD content: | --- inputType: "CA10__CaAwsLambdaFunction__c" testData: - file: "test-data.json" importExtracts: - file: "/types/CA10__CaAwsLambdaFunction__c/object.extracts.yaml" conditions: - status: "INCOMPLIANT" currentStateMessage: "Lambda function tracing with AWS X-Ray is not enabled." remediationMessage: "Enable AWS X-Ray tracing for the function." check: IS_EQUAL: left: EXTRACT: "CA10__tracingConfigResponseMode__c" right: TEXT: "PassThrough" - status: "COMPLIANT" currentStateMessage: "Lambda function tracing with AWS X-Ray is enabled." check: IS_EQUAL: left: EXTRACT: "CA10__tracingConfigResponseMode__c" right: TEXT: "Active" otherwise: status: "UNDETERMINED" currentStateMessage: "Unexpected values in the field." - path: /ce/ca/aws/lambda/function-tracing/test-data.json md5Hash: 95D0517143D8CC6ECF327A96AC447BB9 content: | [ { "expectedResult": { "status": "DISAPPEARED", "conditionIndex": "99", "conditionText": "isDisappeared(CA10__disappearanceTime__c)", "runtimeError": null }, "context": { "snapshotTime": "2025-12-01T00:50:53Z" }, "CA10__disappearanceTime__c": "2025-09-29T19:17:49Z", "CA10__tracingConfigResponseMode__c": "PassThrough", "Id": "001" }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "199", "conditionText": "extract('CA10__tracingConfigResponseMode__c') == 'PassThrough'", "runtimeError": null }, "context": { "snapshotTime": "2025-12-01T00:50:53Z" }, "CA10__disappearanceTime__c": null, "CA10__tracingConfigResponseMode__c": "PassThrough", "Id": "002" }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "299", "conditionText": "extract('CA10__tracingConfigResponseMode__c') == 'Active'", "runtimeError": null }, "context": { "snapshotTime": "2025-12-01T00:50:53Z" }, "CA10__disappearanceTime__c": null, "CA10__tracingConfigResponseMode__c": "Active", "Id": "003" } ] - path: /types/CA10__CaAwsLambdaFunction__c/object.extracts.yaml md5Hash: 76AAEC535F0E5F244F3303D8C3C2C9CE content: "---\nextracts:\n# Nullable. Text.\n - name: \"CA10__runtime__c\"\n\ \ value: \n FIELD:\n path: \"CA10__runtime__c\"\n# Values: PassThrough\ \ | Active. Not nullable. Text.\n - name: \"CA10__tracingConfigResponseMode__c\"\ \n value: \n FIELD:\n path: \"CA10__tracingConfigResponseMode__c\"\ \n undeterminedIf:\n isEmpty: \"The function tracing config\ \ cannot be empty. Possible data corruption.\"\n# Values: Zip | Image. Not nullable.\ \ Text.\n - name: \"CA10__packageType__c\"\n value: \n FIELD:\n \ \ path: \"CA10__packageType__c\"\n undeterminedIf:\n isEmpty:\ \ \"The function package type cannot be empty. Possible data corruption.\"\n\ # Nullable. Can't have no access, retrieved via lambda:ListFunctions\n - name:\ \ \"CA10__vpcId__c\"\n value: \n FIELD:\n path: \"CA10__vpcId__c\"\ \n" script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "001", "expectedResult" : { "status" : "DISAPPEARED", "conditionIndex" : "99", "conditionText" : "isDisappeared(CA10__disappearanceTime__c)", "runtimeError" : null } }, { "Id" : "002", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "199", "conditionText" : "extract('CA10__tracingConfigResponseMode__c') == 'PassThrough'", "runtimeError" : null } }, { "Id" : "003", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "299", "conditionText" : "extract('CA10__tracingConfigResponseMode__c') == 'Active'", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsLambdaFunction__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-12-01T00:50:53Z") }, "CA10__disappearanceTime__c" : new Date("2025-09-29T19:17:49Z"), "CA10__tracingConfigResponseMode__c" : "PassThrough", "Id" : "001" }, { "context" : { "snapshotTime" : new Date("2025-12-01T00:50:53Z") }, "CA10__tracingConfigResponseMode__c" : "PassThrough", "Id" : "002" }, { "context" : { "snapshotTime" : new Date("2025-12-01T00:50:53Z") }, "CA10__tracingConfigResponseMode__c" : "Active", "Id" : "003" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsLambdaFunction__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__tracingConfigResponseMode__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 fieldChecked4() { if (TextLib.isEmpty(obj.CA10__tracingConfigResponseMode__c)) { throw new Error("UNDETERMINED condition:101", {cause: {status: 'UNDETERMINED', conditionIndex: 101, conditionText: "CA10__tracingConfigResponseMode__c.isEmpty()", currentStateMessage: "The function tracing config cannot be empty. Possible data corruption.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__tracingConfigResponseMode__c; } function extract3() { if (!this.out) { this.out = fieldChecked4(); } return this.out; }; references1.push('Tracing Config Mode [obj.CA10__tracingConfigResponseMode__c]: ' + obj.CA10__tracingConfigResponseMode__c); try { if (TextLib.equal(extract3.call(extract3), 'PassThrough')) { return {status: 'INCOMPLIANT', conditionIndex: 199, conditionText: "extract('CA10__tracingConfigResponseMode__c') == 'PassThrough'", currentStateMessage: "Lambda function tracing with AWS X-Ray is not enabled.", currentStateReferences: references1.join('\n'), remediation: "Enable AWS X-Ray tracing for the function.", runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[2], conditionIndex:[200..299] function fieldChecked7() { if (TextLib.isEmpty(obj.CA10__tracingConfigResponseMode__c)) { throw new Error("UNDETERMINED condition:201", {cause: {status: 'UNDETERMINED', conditionIndex: 201, conditionText: "CA10__tracingConfigResponseMode__c.isEmpty()", currentStateMessage: "The function tracing config cannot be empty. Possible data corruption.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__tracingConfigResponseMode__c; } function extract6() { if (!this.out) { this.out = fieldChecked7(); } return this.out; }; try { if (TextLib.equal(extract6.call(extract6), 'Active')) { return {status: 'COMPLIANT', conditionIndex: 299, conditionText: "extract('CA10__tracingConfigResponseMode__c') == 'Active'", currentStateMessage: "Lambda function tracing with AWS X-Ray is enabled.", 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: 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__tracingConfigResponseMode__c AS CA10__tracingConfigResponseMode__c, sObject.Id AS Id, process_CA10__CaAwsLambdaFunction__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__tracingConfigResponseMode__c AS CA10__tracingConfigResponseMode__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAwsLambdaFunction__c()) AS sObject ) sObject ON sObject.Id = expectedResult.Id;