--- policy: /ce/ca/aws/shield/srt-access logic: /ce/ca/aws/shield/srt-access/prod.logic.yaml executionTime: 2026-06-06T12:03:26.722228515Z generationMs: 55 executionMs: 754 rows: - id: test1 match: true status: expected: INAPPLICABLE actual: INAPPLICABLE conditionIndex: expected: 199 actual: 199 conditionText: expected: extract('CA10__status__c') != 'OK' actual: extract('CA10__status__c') != 'OK' runtimeError: {} - id: test2 match: true status: expected: INAPPLICABLE actual: INAPPLICABLE conditionIndex: expected: 299 actual: 299 conditionText: expected: extract('CA10__shieldAdvancedState__c') != 'ACTIVE' actual: extract('CA10__shieldAdvancedState__c') != 'ACTIVE' runtimeError: {} - id: test3 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 399 actual: 399 conditionText: expected: extract('CA10__shieldAdvancedSrtSupportConfigured__c') == 'No' actual: extract('CA10__shieldAdvancedSrtSupportConfigured__c') == 'No' runtimeError: {} - id: test4 match: true status: expected: UNDETERMINED actual: UNDETERMINED conditionIndex: expected: 201 actual: 201 conditionText: expected: CA10__shieldAdvancedState__c.delegatedTo(CA10__shieldAdvancedState__c).isEmpty() actual: CA10__shieldAdvancedState__c.delegatedTo(CA10__shieldAdvancedState__c).isEmpty() runtimeError: {} - id: test5 match: true status: expected: UNDETERMINED actual: UNDETERMINED conditionIndex: expected: 301 actual: 301 conditionText: expected: CA10__shieldAdvancedSrtSupportConfigured__c.delegatedTo(CA10__shieldAdvancedSrtSupportConfigured__c).isEmpty() actual: CA10__shieldAdvancedSrtSupportConfigured__c.delegatedTo(CA10__shieldAdvancedSrtSupportConfigured__c).isEmpty() runtimeError: {} - id: test6 match: true status: expected: UNDETERMINED actual: UNDETERMINED conditionIndex: expected: 201 actual: 201 conditionText: expected: CA10__shieldAdvancedState__c.delegatedTo(CA10__shieldAdvancedState__c).isEmpty() actual: CA10__shieldAdvancedState__c.delegatedTo(CA10__shieldAdvancedState__c).isEmpty() runtimeError: {} usedFiles: - path: /ce/ca/aws/shield/srt-access/policy.yaml md5Hash: 075216BCE8BC0308F4796E367B8D68CA content: "---\nnames:\n full: \"AWS Shield Advanced SRT access is not configured\"\ \n contextual: \"Shield Advanced SRT access is not configured\"\ndescription:\ \ >\n Ensure an IAM role exists to grant the AWS Shield Response Team (SRT)\ \ access \n to the AWS account to help with DDoS event mitigation.\ntype: \"\ COMPLIANCE_POLICY\"\ncategories:\n - \"SECURITY\"\nframeworkMappings:\n -\ \ \"/frameworks/cloudaware/identity-and-access-governance/rbac-management\"\n\ \ - \"/frameworks/aws-well-architected/sec/10/05\"\n" - path: /ce/ca/aws/shield/srt-access/prod.logic.yaml md5Hash: 30645883329DC6DC4375E87F63CC1A21 content: | --- inputType: "CA10__CaAwsAccount__c" testData: - file: "test-data.json" importExtracts: - file: "/types/CA10__CaAwsAccount__c/object.extracts.yaml" conditions: - status: "INAPPLICABLE" currentStateMessage: "CloudAware Collector Status is not OK." check: NOT_EQUAL: left: EXTRACT: "CA10__status__c" right: TEXT: "OK" - status: "INAPPLICABLE" currentStateMessage: "Shield Advanced subscription is not enabled for this AWS Account." check: NOT_EQUAL: left: EXTRACT: "CA10__shieldAdvancedState__c" right: TEXT: "ACTIVE" - status: "INCOMPLIANT" currentStateMessage: "An IAM role for AWS Shield Response Team (SRT) access is not configured." remediationMessage: "Create an IAM role with the 'AWSShieldDRTAccessPolicy' managed policy to allow SRT access." check: IS_EQUAL: left: EXTRACT: "CA10__shieldAdvancedSrtSupportConfigured__c" right: TEXT: "No" - status: "COMPLIANT" currentStateMessage: "An IAM role for AWS Shield Response Team (SRT) access is configured." check: IS_EQUAL: left: EXTRACT: "CA10__shieldAdvancedSrtSupportConfigured__c" right: TEXT: "Yes" otherwise: status: "UNDETERMINED" currentStateMessage: "Unexpected values in the field." - path: /ce/ca/aws/shield/srt-access/test-data.json md5Hash: 189C92A453EAC170888934276FC77845 content: |- [ { "expectedResult": { "status": "INAPPLICABLE", "conditionIndex": "199", "conditionText": "extract('CA10__status__c') != 'OK'", "runtimeError": null }, "context": { "snapshotTime": "2025-11-12T00:15:54Z" }, "CA10__status__c": "Error", "CA10__shieldAdvancedState__c": "INACTIVE", "CA10__shieldAdvancedSrtSupportConfigured__c": "", "Id": "test1" }, { "expectedResult": { "status": "INAPPLICABLE", "conditionIndex": "299", "conditionText": "extract('CA10__shieldAdvancedState__c') != 'ACTIVE'", "runtimeError": null }, "context": { "snapshotTime": "2025-11-12T00:15:54Z" }, "CA10__status__c": "OK", "CA10__shieldAdvancedState__c": "INACTIVE", "CA10__shieldAdvancedSrtSupportConfigured__c": "", "Id": "test2" }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "399", "conditionText": "extract('CA10__shieldAdvancedSrtSupportConfigured__c') == 'No'", "runtimeError": null }, "context": { "snapshotTime": "2025-11-12T00:15:54Z" }, "CA10__status__c": "OK", "CA10__shieldAdvancedState__c": "ACTIVE", "CA10__shieldAdvancedSrtSupportConfigured__c": "No", "Id": "test3" }, { "expectedResult": { "status": "UNDETERMINED", "conditionIndex": "201", "conditionText": "CA10__shieldAdvancedState__c.delegatedTo(CA10__shieldAdvancedState__c).isEmpty()", "runtimeError": null }, "context": { "snapshotTime": "2025-11-12T00:15:54Z" }, "CA10__status__c": "OK", "CA10__shieldAdvancedState__c": "", "CA10__shieldAdvancedSrtSupportConfigured__c": "", "Id": "test4" }, { "expectedResult": { "status": "UNDETERMINED", "conditionIndex": "301", "conditionText": "CA10__shieldAdvancedSrtSupportConfigured__c.delegatedTo(CA10__shieldAdvancedSrtSupportConfigured__c).isEmpty()", "runtimeError": null }, "context": { "snapshotTime": "2025-11-12T00:15:54Z" }, "CA10__status__c": "OK", "CA10__shieldAdvancedState__c": "ACTIVE", "CA10__shieldAdvancedSrtSupportConfigured__c": "", "Id": "test5" }, { "expectedResult": { "status": "UNDETERMINED", "conditionIndex": "201", "conditionText": "CA10__shieldAdvancedState__c.delegatedTo(CA10__shieldAdvancedState__c).isEmpty()", "runtimeError": null }, "context": { "snapshotTime": "2025-11-12T00:15:54Z" }, "CA10__status__c": "OK", "CA10__shieldAdvancedState__c": "", "CA10__shieldAdvancedSrtSupportConfigured__c": "Yes", "Id": "test6" } ] - path: /types/CA10__CaAwsAccount__c/object.extracts.yaml md5Hash: 926999C100E8C1066EC8BD4B82B0F362 content: "---\nextracts:\n - name: CA10__accountId__c\n value: \n FIELD:\n\ \ path: CA10__accountId__c\n undeterminedIf:\n isEmpty:\ \ \"Account ID can not be empty. Possibly corrupted data.\"\n# Not nullable\n\ \ - name: \"CA10__shieldAdvancedState__c\"\n value: \n FIELD:\n \ \ path: \"CA10__shieldAdvancedState__c\"\n undeterminedIf:\n \ \ noAccessDelegate:\n path: \"CA10__shieldAdvancedState__c\"\ \n currentStateMessage: \"Shield Advanced subscription state cannot\ \ be empty. Possible permission issue with shield:GetSubscriptionState\"\n#\ \ Not nullable\n - name: \"CA10__shieldAdvancedSrtSupportConfigured__c\"\n\ \ value: \n FIELD:\n path: \"CA10__shieldAdvancedSrtSupportConfigured__c\"\ \n undeterminedIf:\n noAccessDelegate:\n path: \"\ CA10__shieldAdvancedSrtSupportConfigured__c\"\n currentStateMessage:\ \ \"Shield Advanced SRT Access state cannot be empty. Possible permission issue\ \ with shield:DescribeDRTAccess\"\n# Not nullable\n - name: \"CA10__status__c\"\ \n value: \n FIELD:\n path: \"CA10__status__c\"\n - name: \"\ CA10__inspectorStatus__c\"\n value: \n FIELD:\n path: \"CA10__inspectorStatus__c\"\ \n - name: \"CA10__inspectorEc2Status__c\"\n value: \n FIELD:\n \ \ path: \"CA10__inspectorEc2Status__c\"\n - name: \"CA10__inspectorEcrStatus__c\"\ \n value: \n FIELD:\n path: \"CA10__inspectorEcrStatus__c\"\n\ \ - name: \"CA10__inspectorLambdaCodeStatus__c\"\n value: \n FIELD:\n\ \ path: \"CA10__inspectorLambdaCodeStatus__c\"\n - name: \"CA10__inspectorLambdaStatus__c\"\ \n value: \n FIELD:\n path: \"CA10__inspectorLambdaStatus__c\"\ \n" script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "test1", "expectedResult" : { "status" : "INAPPLICABLE", "conditionIndex" : "199", "conditionText" : "extract('CA10__status__c') != 'OK'", "runtimeError" : null } }, { "Id" : "test2", "expectedResult" : { "status" : "INAPPLICABLE", "conditionIndex" : "299", "conditionText" : "extract('CA10__shieldAdvancedState__c') != 'ACTIVE'", "runtimeError" : null } }, { "Id" : "test3", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "399", "conditionText" : "extract('CA10__shieldAdvancedSrtSupportConfigured__c') == 'No'", "runtimeError" : null } }, { "Id" : "test4", "expectedResult" : { "status" : "UNDETERMINED", "conditionIndex" : "201", "conditionText" : "CA10__shieldAdvancedState__c.delegatedTo(CA10__shieldAdvancedState__c).isEmpty()", "runtimeError" : null } }, { "Id" : "test5", "expectedResult" : { "status" : "UNDETERMINED", "conditionIndex" : "301", "conditionText" : "CA10__shieldAdvancedSrtSupportConfigured__c.delegatedTo(CA10__shieldAdvancedSrtSupportConfigured__c).isEmpty()", "runtimeError" : null } }, { "Id" : "test6", "expectedResult" : { "status" : "UNDETERMINED", "conditionIndex" : "201", "conditionText" : "CA10__shieldAdvancedState__c.delegatedTo(CA10__shieldAdvancedState__c).isEmpty()", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsAccount__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-11-12T00:15:54Z") }, "CA10__status__c" : "Error", "CA10__shieldAdvancedState__c" : "INACTIVE", "CA10__shieldAdvancedSrtSupportConfigured__c" : "", "Id" : "test1" }, { "context" : { "snapshotTime" : new Date("2025-11-12T00:15:54Z") }, "CA10__status__c" : "OK", "CA10__shieldAdvancedState__c" : "INACTIVE", "CA10__shieldAdvancedSrtSupportConfigured__c" : "", "Id" : "test2" }, { "context" : { "snapshotTime" : new Date("2025-11-12T00:15:54Z") }, "CA10__status__c" : "OK", "CA10__shieldAdvancedState__c" : "ACTIVE", "CA10__shieldAdvancedSrtSupportConfigured__c" : "No", "Id" : "test3" }, { "context" : { "snapshotTime" : new Date("2025-11-12T00:15:54Z") }, "CA10__status__c" : "OK", "CA10__shieldAdvancedState__c" : "", "CA10__shieldAdvancedSrtSupportConfigured__c" : "", "Id" : "test4" }, { "context" : { "snapshotTime" : new Date("2025-11-12T00:15:54Z") }, "CA10__status__c" : "OK", "CA10__shieldAdvancedState__c" : "ACTIVE", "CA10__shieldAdvancedSrtSupportConfigured__c" : "", "Id" : "test5" }, { "context" : { "snapshotTime" : new Date("2025-11-12T00:15:54Z") }, "CA10__status__c" : "OK", "CA10__shieldAdvancedState__c" : "", "CA10__shieldAdvancedSrtSupportConfigured__c" : "Yes", "Id" : "test6" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsAccount__c( obj STRUCT< CA10__status__c STRING, CA10__shieldAdvancedState__c STRING, CA10__shieldAdvancedSrtSupportConfigured__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] if (false) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared()", 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__status__c; } return this.out; }; references1.push('Role Status: Collector [obj.CA10__status__c]: ' + obj.CA10__status__c); if (TextLib.notEqual(extract3.call(extract3), 'OK')) { return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "extract('CA10__status__c') != 'OK'", currentStateMessage: "CloudAware Collector Status is not OK.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[2], conditionIndex:[200..299] function fieldChecked7() { if (TextLib.isEmpty(obj.CA10__shieldAdvancedState__c)) { throw new Error("UNDETERMINED condition:201", {cause: {status: 'UNDETERMINED', conditionIndex: 201, conditionText: "CA10__shieldAdvancedState__c.delegatedTo(CA10__shieldAdvancedState__c).isEmpty()", currentStateMessage: "Shield Advanced subscription state cannot be empty. Possible permission issue with shield:GetSubscriptionState", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__shieldAdvancedState__c; } function extract6() { if (!this.out) { this.out = fieldChecked7(); } return this.out; }; references1.push('Shield Advanced: State [obj.CA10__shieldAdvancedState__c]: ' + obj.CA10__shieldAdvancedState__c); try { if (TextLib.notEqual(extract6.call(extract6), 'ACTIVE')) { return {status: 'INAPPLICABLE', conditionIndex: 299, conditionText: "extract('CA10__shieldAdvancedState__c') != 'ACTIVE'", currentStateMessage: "Shield Advanced subscription is not enabled for this AWS Account.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[3], conditionIndex:[300..399] function fieldChecked10() { if (TextLib.isEmpty(obj.CA10__shieldAdvancedSrtSupportConfigured__c)) { throw new Error("UNDETERMINED condition:301", {cause: {status: 'UNDETERMINED', conditionIndex: 301, conditionText: "CA10__shieldAdvancedSrtSupportConfigured__c.delegatedTo(CA10__shieldAdvancedSrtSupportConfigured__c).isEmpty()", currentStateMessage: "Shield Advanced SRT Access state cannot be empty. Possible permission issue with shield:DescribeDRTAccess", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__shieldAdvancedSrtSupportConfigured__c; } function extract9() { if (!this.out) { this.out = fieldChecked10(); } return this.out; }; references1.push('Shield Advanced: SRT Support Configured [obj.CA10__shieldAdvancedSrtSupportConfigured__c]: ' + obj.CA10__shieldAdvancedSrtSupportConfigured__c); try { if (TextLib.equal(extract9.call(extract9), 'No')) { return {status: 'INCOMPLIANT', conditionIndex: 399, conditionText: "extract('CA10__shieldAdvancedSrtSupportConfigured__c') == 'No'", currentStateMessage: "An IAM role for AWS Shield Response Team (SRT) access is not configured.", currentStateReferences: references1.join('\n'), remediation: "Create an IAM role with the 'AWSShieldDRTAccessPolicy' managed policy to allow SRT access.", runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[4], conditionIndex:[400..499] function fieldChecked13() { if (TextLib.isEmpty(obj.CA10__shieldAdvancedSrtSupportConfigured__c)) { throw new Error("UNDETERMINED condition:401", {cause: {status: 'UNDETERMINED', conditionIndex: 401, conditionText: "CA10__shieldAdvancedSrtSupportConfigured__c.delegatedTo(CA10__shieldAdvancedSrtSupportConfigured__c).isEmpty()", currentStateMessage: "Shield Advanced SRT Access state cannot be empty. Possible permission issue with shield:DescribeDRTAccess", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__shieldAdvancedSrtSupportConfigured__c; } function extract12() { if (!this.out) { this.out = fieldChecked13(); } return this.out; }; try { if (TextLib.equal(extract12.call(extract12), 'Yes')) { return {status: 'COMPLIANT', conditionIndex: 499, conditionText: "extract('CA10__shieldAdvancedSrtSupportConfigured__c') == 'Yes'", currentStateMessage: "An IAM role for AWS Shield Response Team (SRT) access is configured.", 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__status__c AS CA10__status__c, sObject.CA10__shieldAdvancedState__c AS CA10__shieldAdvancedState__c, sObject.CA10__shieldAdvancedSrtSupportConfigured__c AS CA10__shieldAdvancedSrtSupportConfigured__c, sObject.Id AS Id, process_CA10__CaAwsAccount__c( STRUCT( sObject.CA10__status__c AS CA10__status__c, sObject.CA10__shieldAdvancedState__c AS CA10__shieldAdvancedState__c, sObject.CA10__shieldAdvancedSrtSupportConfigured__c AS CA10__shieldAdvancedSrtSupportConfigured__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAwsAccount__c()) AS sObject ) sObject ON sObject.Id = expectedResult.Id;