--- policy: /ce/ca/aws/vpc/flow-logs logic: /ce/ca/aws/vpc/flow-logs/prod.logic.yaml executionTime: 2026-05-09T12:04:04.52136037Z generationMs: 53 executionMs: 2378 rows: - id: test1 match: true status: expected: DISAPPEARED actual: DISAPPEARED conditionIndex: expected: 99 actual: 99 conditionText: expected: isDisappeared(CA10__disappearanceTime__c) actual: isDisappeared(CA10__disappearanceTime__c) runtimeError: {} - id: test2 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 199 actual: 199 conditionText: expected: CA10__AWS_VPC_Flow_Logs__r.hasNo(COMPLIANT) actual: CA10__AWS_VPC_Flow_Logs__r.hasNo(COMPLIANT) runtimeError: {} - id: test3 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 299 actual: 299 conditionText: expected: CA10__AWS_VPC_Flow_Logs__r.has(COMPLIANT) actual: CA10__AWS_VPC_Flow_Logs__r.has(COMPLIANT) runtimeError: {} usedFiles: - path: /ce/ca/aws/vpc/flow-logs/policy.yaml md5Hash: 33FD2E8B32FB6E7B2A6C2283FD4B0291 content: | --- names: full: AWS VPC Flow Logs are not enabled contextual: Flow Logs are not enabled description: "VPC Flow Logs is a feature that enables you to capture information about\ \ the IP traffic going to and from network interfaces in your VPC. After you've\ \ created a flow log, you can view and retrieve its data in Amazon CloudWatch Logs.\ \ It is recommended that VPC Flow Logs be enabled for packet 'Rejects' for VPCs." type: COMPLIANCE_POLICY categories: - "SECURITY" - "RELIABILITY" frameworkMappings: - "/frameworks/cis-aws-v7.0.0/04/07" - "/frameworks/cloudaware/logging-and-monitoring/logging-and-monitoring-configuration" - "/frameworks/aws-fsbp-v1.0.0/ec2/06" similarPolicies: awsSecurityHub: - name: "[EC2.6] VPC flow logging should be enabled in all VPCs" url: "https://docs.aws.amazon.com/securityhub/latest/userguide/ec2-controls.html#ec2-6" cloudConformity: - url: https://www.trendmicro.com/cloudoneconformity/knowledge-base/aws/VPC/vpc-flow-logs-enabled.html name: VPC Flow Logs Enabled internal: - dec-x-9c041667 - path: /ce/ca/aws/vpc/flow-logs/prod.logic.yaml md5Hash: EB4AD7D6BEC59C0C6ADA4E9A140505B2 content: | --- inputType: "CA10__CaAwsVpc__c" testData: - file: "test-data.json" conditions: - status: "INCOMPLIANT" currentStateMessage: "VPC flow logging is disabled." remediationMessage: "Enable VPC flow logging." check: RELATED_LIST_HAS_NO: status: "COMPLIANT" relationshipName: "CA10__AWS_VPC_Flow_Logs__r" - status: "COMPLIANT" currentStateMessage: "VPC flow logging is enabled." check: RELATED_LIST_HAS: status: "COMPLIANT" relationshipName: "CA10__AWS_VPC_Flow_Logs__r" otherwise: status: "UNDETERMINED" currentStateMessage: "Unexpected values in the fields." relatedLists: - relationshipName: "CA10__AWS_VPC_Flow_Logs__r" conditions: [] otherwise: status: "COMPLIANT" currentStateMessage: "VPC flow logging is enabled." - path: /ce/ca/aws/vpc/flow-logs/test-data.json md5Hash: 31DE834F1018FB3952D3AE87F3953DEB content: |- [ { "expectedResult": { "status": "DISAPPEARED", "conditionIndex": "99", "conditionText": "isDisappeared(CA10__disappearanceTime__c)", "runtimeError": null }, "context": { "snapshotTime": "2024-05-28T17:35:50Z" }, "Id": "test1", "CA10__disappearanceTime__c": "2024-05-22T17:29:41Z", "CA10__AWS_VPC_Flow_Logs__r": [] }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "199", "conditionText": "CA10__AWS_VPC_Flow_Logs__r.hasNo(COMPLIANT)", "runtimeError": null }, "context": { "snapshotTime": "2024-05-28T17:35:50Z" }, "Id": "test2", "CA10__disappearanceTime__c": null, "CA10__AWS_VPC_Flow_Logs__r": [] }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "299", "conditionText": "CA10__AWS_VPC_Flow_Logs__r.has(COMPLIANT)", "runtimeError": null }, "context": { "snapshotTime": "2024-05-28T17:35:50Z" }, "Id": "test3", "CA10__disappearanceTime__c": null, "CA10__AWS_VPC_Flow_Logs__r": [ { "Id": "test3_1", "CA10__disappearanceTime__c": null, "CA10__vpc__c": "test3" } ] } ] script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "test1", "expectedResult" : { "status" : "DISAPPEARED", "conditionIndex" : "99", "conditionText" : "isDisappeared(CA10__disappearanceTime__c)", "runtimeError" : null } }, { "Id" : "test2", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "199", "conditionText" : "CA10__AWS_VPC_Flow_Logs__r.hasNo(COMPLIANT)", "runtimeError" : null } }, { "Id" : "test3", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "299", "conditionText" : "CA10__AWS_VPC_Flow_Logs__r.has(COMPLIANT)", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsVpc__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2024-05-28T17:35:50Z") }, "CA10__disappearanceTime__c" : new Date("2024-05-22T17:29:41Z"), "Id" : "test1" }, { "context" : { "snapshotTime" : new Date("2024-05-28T17:35:50Z") }, "Id" : "test2" }, { "context" : { "snapshotTime" : new Date("2024-05-28T17:35:50Z") }, "Id" : "test3" } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsVpcFlowLog__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2024-05-28T17:35:50Z") }, "CA10__vpc__c" : "test3", "Id" : "test3_1" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsVpc__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, Id STRING, CA10__AWS_VPC_Flow_Logs__r ARRAY >> >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" var references1 = []; // condition[0], conditionIndex:[0..99] references1.push('Deleted From AWS [CA10__disappearanceTime__c]: ' + obj.CA10__disappearanceTime__c); if (obj.CA10__disappearanceTime__c != null) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10__disappearanceTime__c)", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } var count_CA10__AWS_VPC_Flow_Logs__r_COMPLIANT2 = 0; if (obj.CA10__AWS_VPC_Flow_Logs__r != null) { for (var i3 = 0; i3 < obj.CA10__AWS_VPC_Flow_Logs__r.length; i3++) { if (typeof(obj.CA10__AWS_VPC_Flow_Logs__r[i3].status) !== 'undefined') { if (obj.CA10__AWS_VPC_Flow_Logs__r[i3].status == 'COMPLIANT') { count_CA10__AWS_VPC_Flow_Logs__r_COMPLIANT2 += obj.CA10__AWS_VPC_Flow_Logs__r[i3].count; } } else { if (obj.CA10__AWS_VPC_Flow_Logs__r[i3].result.status == 'COMPLIANT') { count_CA10__AWS_VPC_Flow_Logs__r_COMPLIANT2 += 1; } } } } // condition[1], conditionIndex:[100..199] references1.push('Related list [CA10__AWS_VPC_Flow_Logs__r] ' + (count_CA10__AWS_VPC_Flow_Logs__r_COMPLIANT2 == 0 ? 'does not have' : 'has') + ' objects in COMPLIANT status'); if (count_CA10__AWS_VPC_Flow_Logs__r_COMPLIANT2 == 0) { return {status: 'INCOMPLIANT', conditionIndex: 199, conditionText: "CA10__AWS_VPC_Flow_Logs__r.hasNo(COMPLIANT)", currentStateMessage: "VPC flow logging is disabled.", currentStateReferences: references1.join('\n'), remediation: "Enable VPC flow logging.", runtimeError: null}; } var count_CA10__AWS_VPC_Flow_Logs__r_COMPLIANT2 = 0; if (obj.CA10__AWS_VPC_Flow_Logs__r != null) { for (var i4 = 0; i4 < obj.CA10__AWS_VPC_Flow_Logs__r.length; i4++) { if (typeof(obj.CA10__AWS_VPC_Flow_Logs__r[i4].status) !== 'undefined') { if (obj.CA10__AWS_VPC_Flow_Logs__r[i4].status == 'COMPLIANT') { count_CA10__AWS_VPC_Flow_Logs__r_COMPLIANT2 += obj.CA10__AWS_VPC_Flow_Logs__r[i4].count; } } else { if (obj.CA10__AWS_VPC_Flow_Logs__r[i4].result.status == 'COMPLIANT') { count_CA10__AWS_VPC_Flow_Logs__r_COMPLIANT2 += 1; } } } } // condition[2], conditionIndex:[200..299] if (count_CA10__AWS_VPC_Flow_Logs__r_COMPLIANT2 > 0) { return {status: 'COMPLIANT', conditionIndex: 299, conditionText: "CA10__AWS_VPC_Flow_Logs__r.has(COMPLIANT)", currentStateMessage: "VPC flow logging is enabled.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'UNDETERMINED', conditionIndex: 300, conditionText: "otherwise", currentStateMessage: "Unexpected values in the fields.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; """; CREATE TEMP FUNCTION process_CA10__AWS_VPC_Flow_Logs__r( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__vpc__c STRING, Id STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" var references1 = []; // condition[0], conditionIndex:[0..99] references1.push('Deleted From AWS [CA10__disappearanceTime__c]: ' + obj.CA10__disappearanceTime__c); if (obj.CA10__disappearanceTime__c != null) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10__disappearanceTime__c)", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'COMPLIANT', conditionIndex: 100, conditionText: "otherwise", currentStateMessage: "VPC flow logging is enabled.", 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.Id AS Id, `CA10__AWS_VPC_Flow_Logs__r`.arr AS CA10__AWS_VPC_Flow_Logs__r, process_CA10__CaAwsVpc__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.Id AS Id, `CA10__AWS_VPC_Flow_Logs__r`.arr AS CA10__AWS_VPC_Flow_Logs__r ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAwsVpc__c()) AS sObject LEFT JOIN ( SELECT sObject.CA10__vpc__c, ARRAY_AGG( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__vpc__c AS CA10__vpc__c, sObject.Id AS Id, process_CA10__AWS_VPC_Flow_Logs__r( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__vpc__c AS CA10__vpc__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result ) ) AS arr FROM UNNEST(mock_CA10__CaAwsVpcFlowLog__c()) AS sObject GROUP BY sObject.CA10__vpc__c ) AS `CA10__AWS_VPC_Flow_Logs__r` ON sObject.Id = `CA10__AWS_VPC_Flow_Logs__r`.CA10__vpc__c ) sObject ON sObject.Id = expectedResult.Id;