--- policy: /ce/ca/aws/vpc/disable-subnet-map-public-ip-on-launch logic: /ce/ca/aws/vpc/disable-subnet-map-public-ip-on-launch/prod.logic.yaml executionTime: 2026-06-06T12:03:27.333838644Z generationMs: 47 executionMs: 843 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: 299 actual: 299 conditionText: expected: extract('CA10__mapPublicIpOnLaunch__c') actual: extract('CA10__mapPublicIpOnLaunch__c') runtimeError: {} - id: test3 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 400 actual: 400 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: test4 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 199 actual: 199 conditionText: expected: extract('CA10__mapPublicIpOnLaunch__c') && extract('CA10__assignIpv6AddressOnCreation__c') actual: extract('CA10__mapPublicIpOnLaunch__c') && extract('CA10__assignIpv6AddressOnCreation__c') runtimeError: {} - id: test5 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 399 actual: 399 conditionText: expected: extract('CA10__assignIpv6AddressOnCreation__c') actual: extract('CA10__assignIpv6AddressOnCreation__c') runtimeError: {} usedFiles: - path: /ce/ca/aws/vpc/disable-subnet-map-public-ip-on-launch/policy.yaml md5Hash: 89931E1436AC505402F23DC7C610353D content: "---\nnames:\n full: AWS VPC Subnet Map Public IP On Launch is enabled\n\ \ contextual: Subnet Map Public IP On Launch is enabled\ndescription: >\n \ \ Ensure that AWS VPC Subnets are not configured to automatically assign \n\ \ public IP addresses to EC2 Instances launched within them.\ntype: COMPLIANCE_POLICY\n\ categories:\n - SECURITY\nframeworkMappings:\n - \"/frameworks/cloudaware/resource-security/network-exposure\"\ \n - \"/frameworks/aws-fsbp-v1.0.0/ec2/15\"\nsimilarPolicies:\n awsSecurityHub:\n\ \ - name: \"[EC2.15] Amazon EC2 subnets should not automatically assign public\ \ IP addresses\"\n url: \"https://docs.aws.amazon.com/securityhub/latest/userguide/ec2-controls.html#ec2-15\"\ \n" - path: /ce/ca/aws/vpc/disable-subnet-map-public-ip-on-launch/prod.logic.yaml md5Hash: 5348D2EBA3F79F81344072A1C21E5383 content: | --- inputType: "CA10__CaAwsSubnet__c" testData: - file: "test-data.json" importExtracts: - file: "/types/CA10__CaAwsSubnet__c/object.extracts.yaml" conditions: - status: "INCOMPLIANT" currentStateMessage: "The subnet is configured to automatically assign IPv4 and IPv6 addresses to instances at launch." remediationMessage: "Disable the 'auto-assign public IP address' setting for this subnet to prevent unintended exposure of instances to the internet." check: AND: args: - EXTRACT: "CA10__mapPublicIpOnLaunch__c" - EXTRACT: "CA10__assignIpv6AddressOnCreation__c" - status: "INCOMPLIANT" currentStateMessage: "The subnet is configured to automatically assign public IPv4 addresses to instances at launch." remediationMessage: "Disable the 'auto-assign public IP address' setting for this subnet to prevent unintended exposure of instances to the internet." check: EXTRACT: "CA10__mapPublicIpOnLaunch__c" - status: "INCOMPLIANT" currentStateMessage: "The subnet is configured to automatically assign public IPv6 addresses to instances at launch." remediationMessage: "Disable the 'auto-assign public IP address' setting for this subnet to prevent unintended exposure of instances to the internet." check: EXTRACT: "CA10__assignIpv6AddressOnCreation__c" otherwise: status: "COMPLIANT" currentStateMessage: "The subnet is not configured to automatically assign public IP addresses." - path: /ce/ca/aws/vpc/disable-subnet-map-public-ip-on-launch/test-data.json md5Hash: D3EF82F265878BC951BAE4962208B81B content: |- [ { "CA10__assignIpv6AddressOnCreation__c": false, "expectedResult": { "runtimeError": null, "conditionText": "isDisappeared(CA10__disappearanceTime__c)", "conditionIndex": 99, "status": "DISAPPEARED" }, "context": { "snapshotTime": "2026-02-02T13:34:44Z" }, "CA10__mapPublicIpOnLaunch__c": true, "Id": "test1", "CA10__disappearanceTime__c": "2025-08-15T04:30:48Z" }, { "CA10__assignIpv6AddressOnCreation__c": false, "expectedResult": { "runtimeError": null, "conditionText": "extract('CA10__mapPublicIpOnLaunch__c')", "conditionIndex": 299, "status": "INCOMPLIANT" }, "context": { "snapshotTime": "2026-02-02T13:34:44Z" }, "CA10__mapPublicIpOnLaunch__c": true, "Id": "test2", "CA10__disappearanceTime__c": null }, { "CA10__assignIpv6AddressOnCreation__c": false, "expectedResult": { "runtimeError": null, "conditionText": "otherwise", "conditionIndex": 400, "status": "COMPLIANT" }, "context": { "snapshotTime": "2026-02-02T13:34:44Z" }, "CA10__mapPublicIpOnLaunch__c": false, "Id": "test3", "CA10__disappearanceTime__c": null }, { "CA10__assignIpv6AddressOnCreation__c": true, "expectedResult": { "runtimeError": null, "conditionText": "extract('CA10__mapPublicIpOnLaunch__c') && extract('CA10__assignIpv6AddressOnCreation__c')", "conditionIndex": 199, "status": "INCOMPLIANT" }, "context": { "snapshotTime": "2026-02-02T13:34:44Z" }, "CA10__mapPublicIpOnLaunch__c": true, "Id": "test4", "CA10__disappearanceTime__c": null }, { "CA10__assignIpv6AddressOnCreation__c": true, "expectedResult": { "runtimeError": null, "conditionText": "extract('CA10__assignIpv6AddressOnCreation__c')", "conditionIndex": 399, "status": "INCOMPLIANT" }, "context": { "snapshotTime": "2026-02-02T13:34:44Z" }, "CA10__mapPublicIpOnLaunch__c": false, "Id": "test5", "CA10__disappearanceTime__c": null } ] - path: /types/CA10__CaAwsSubnet__c/object.extracts.yaml md5Hash: 393E30CD97C9DEE73FA18A1456EE4CBD content: "---\nextracts:\n# Checkbox. Can't have no access, retrieved via ec2:DescribeSubnets\n\ \ - name: CA10__defaultForAz__c\n value: \n FIELD:\n path: CA10__defaultForAz__c\n\ # Checkbox. Can't have no access, retrieved via ec2:DescribeSubnets\n - name:\ \ CA10__mapPublicIpOnLaunch__c\n value: \n FIELD:\n path: CA10__mapPublicIpOnLaunch__c\n\ # Checkbox. Can't have no access, retrieved via ec2:DescribeSubnets\n - name:\ \ CA10__assignIpv6AddressOnCreation__c\n value: \n FIELD:\n path:\ \ CA10__assignIpv6AddressOnCreation__c\n" script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "test1", "expectedResult" : { "runtimeError" : null, "conditionText" : "isDisappeared(CA10__disappearanceTime__c)", "conditionIndex" : 99, "status" : "DISAPPEARED" } }, { "Id" : "test2", "expectedResult" : { "runtimeError" : null, "conditionText" : "extract('CA10__mapPublicIpOnLaunch__c')", "conditionIndex" : 299, "status" : "INCOMPLIANT" } }, { "Id" : "test3", "expectedResult" : { "runtimeError" : null, "conditionText" : "otherwise", "conditionIndex" : 400, "status" : "COMPLIANT" } }, { "Id" : "test4", "expectedResult" : { "runtimeError" : null, "conditionText" : "extract('CA10__mapPublicIpOnLaunch__c') && extract('CA10__assignIpv6AddressOnCreation__c')", "conditionIndex" : 199, "status" : "INCOMPLIANT" } }, { "Id" : "test5", "expectedResult" : { "runtimeError" : null, "conditionText" : "extract('CA10__assignIpv6AddressOnCreation__c')", "conditionIndex" : 399, "status" : "INCOMPLIANT" } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsSubnet__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2026-02-02T13:34:44Z") }, "CA10__disappearanceTime__c" : new Date("2025-08-15T04:30:48Z"), "CA10__mapPublicIpOnLaunch__c" : true, "CA10__assignIpv6AddressOnCreation__c" : false, "Id" : "test1" }, { "context" : { "snapshotTime" : new Date("2026-02-02T13:34:44Z") }, "CA10__mapPublicIpOnLaunch__c" : true, "CA10__assignIpv6AddressOnCreation__c" : false, "Id" : "test2" }, { "context" : { "snapshotTime" : new Date("2026-02-02T13:34:44Z") }, "CA10__mapPublicIpOnLaunch__c" : false, "CA10__assignIpv6AddressOnCreation__c" : false, "Id" : "test3" }, { "context" : { "snapshotTime" : new Date("2026-02-02T13:34:44Z") }, "CA10__mapPublicIpOnLaunch__c" : true, "CA10__assignIpv6AddressOnCreation__c" : true, "Id" : "test4" }, { "context" : { "snapshotTime" : new Date("2026-02-02T13:34:44Z") }, "CA10__mapPublicIpOnLaunch__c" : false, "CA10__assignIpv6AddressOnCreation__c" : true, "Id" : "test5" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsSubnet__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__mapPublicIpOnLaunch__c BOOLEAN, CA10__assignIpv6AddressOnCreation__c BOOLEAN, 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}; } // condition[1], conditionIndex:[100..199] function extract3() { if (!this.out) { this.out = obj.CA10__mapPublicIpOnLaunch__c; } return this.out; }; function extract6() { if (!this.out) { this.out = obj.CA10__assignIpv6AddressOnCreation__c; } return this.out; }; references1.push('Map Public IP On Launch [obj.CA10__mapPublicIpOnLaunch__c]: ' + obj.CA10__mapPublicIpOnLaunch__c); references1.push('Assign IPv6 Address On Creation [obj.CA10__assignIpv6AddressOnCreation__c]: ' + obj.CA10__assignIpv6AddressOnCreation__c); if (extract3.call(extract3) && extract6.call(extract6)) { return {status: 'INCOMPLIANT', conditionIndex: 199, conditionText: "extract('CA10__mapPublicIpOnLaunch__c') && extract('CA10__assignIpv6AddressOnCreation__c')", currentStateMessage: "The subnet is configured to automatically assign IPv4 and IPv6 addresses to instances at launch.", currentStateReferences: references1.join('\n'), remediation: "Disable the 'auto-assign public IP address' setting for this subnet to prevent unintended exposure of instances to the internet.", runtimeError: null}; } // condition[2], conditionIndex:[200..299] function extract9() { if (!this.out) { this.out = obj.CA10__mapPublicIpOnLaunch__c; } return this.out; }; if (extract9.call(extract9)) { return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "extract('CA10__mapPublicIpOnLaunch__c')", currentStateMessage: "The subnet is configured to automatically assign public IPv4 addresses to instances at launch.", currentStateReferences: references1.join('\n'), remediation: "Disable the 'auto-assign public IP address' setting for this subnet to prevent unintended exposure of instances to the internet.", runtimeError: null}; } // condition[3], conditionIndex:[300..399] function extract12() { if (!this.out) { this.out = obj.CA10__assignIpv6AddressOnCreation__c; } return this.out; }; if (extract12.call(extract12)) { return {status: 'INCOMPLIANT', conditionIndex: 399, conditionText: "extract('CA10__assignIpv6AddressOnCreation__c')", currentStateMessage: "The subnet is configured to automatically assign public IPv6 addresses to instances at launch.", currentStateReferences: references1.join('\n'), remediation: "Disable the 'auto-assign public IP address' setting for this subnet to prevent unintended exposure of instances to the internet.", runtimeError: null}; } return {status: 'COMPLIANT', conditionIndex: 400, conditionText: "otherwise", currentStateMessage: "The subnet is not configured to automatically assign public IP addresses.", 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__mapPublicIpOnLaunch__c AS CA10__mapPublicIpOnLaunch__c, sObject.CA10__assignIpv6AddressOnCreation__c AS CA10__assignIpv6AddressOnCreation__c, sObject.Id AS Id, process_CA10__CaAwsSubnet__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__mapPublicIpOnLaunch__c AS CA10__mapPublicIpOnLaunch__c, sObject.CA10__assignIpv6AddressOnCreation__c AS CA10__assignIpv6AddressOnCreation__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAwsSubnet__c()) AS sObject ) sObject ON sObject.Id = expectedResult.Id;