--- policy: /ce/ca/aws/opensearch/domain-vpc-endpoint logic: /ce/ca/aws/opensearch/domain-vpc-endpoint/prod.logic.yaml executionTime: 2026-06-06T12:03:10.888854707Z generationMs: 51 executionMs: 870 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__endpoint__c').isNotEmpty() actual: extract('CA10__endpoint__c').isNotEmpty() runtimeError: {} - id: test3 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 399 actual: 399 conditionText: expected: extract('CA10__vpcEndpoints__c').isNotEmpty() actual: extract('CA10__vpcEndpoints__c').isNotEmpty() runtimeError: {} usedFiles: - path: /ce/ca/aws/opensearch/domain-vpc-endpoint/policy.yaml md5Hash: F77C207D60B77B9DCBD9A37DC002BE77 content: "---\nnames:\n full: \"AWS OpenSearch Domain has a public endpoint\"\ \n contextual: \"Domain has a public endpoint\"\ndescription: >\n Ensure that\ \ AWS OpenSearch Domains are deployed within a VPC to restrict access \n and\ \ enhance security. Public endpoints expose the domain to the internet, \n \ \ increasing the risk of unauthorized access.\ntype: \"COMPLIANCE_POLICY\"\n\ categories:\n - \"SECURITY\"\nframeworkMappings:\n - \"/frameworks/cloudaware/resource-security/network-exposure\"\ \n - \"/frameworks/aws-fsbp-v1.0.0/es/02\"\n - \"/frameworks/aws-fsbp-v1.0.0/opensearch/02\"\ \nsimilarPolicies:\n awsSecurityHub:\n - name: \"[Opensearch.2] OpenSearch\ \ domains should not be publicly accessible\"\n url: \"https://docs.aws.amazon.com/securityhub/latest/userguide/opensearch-controls.html#opensearch-2\"\ \n - name: \"[ES.2] Elasticsearch domains should not be publicly accessible\"\ \n url: \"https://docs.aws.amazon.com/securityhub/latest/userguide/es-controls.html#es-2\"\ \n" - path: /ce/ca/aws/opensearch/domain-vpc-endpoint/prod.logic.yaml md5Hash: B3DAC2985B0BFC9425F8778675553F07 content: "---\ninputType: \"CA10__CaAwsElasticsearchDomain__c\"\ntestData:\n \ \ - file: \"test-data.json\"\nimportExtracts:\n - file: \"/types/CA10__CaAwsElasticsearchDomain__c/object.extracts.yaml\"\ \nconditions:\n - status: \"UNDETERMINED\"\n currentStateMessage: \"Unable\ \ to determine the OpenSearch domain endpoint configuration.\"\n check:\n\ \ AND:\n args:\n - IS_EMPTY:\n arg: \n \ \ EXTRACT: \"CA10__endpoint__c\"\n - IS_EMPTY:\n \ \ arg: \n EXTRACT: \"CA10__vpcEndpoints__c\" \ \ \n - status: \"INCOMPLIANT\"\n currentStateMessage: \"The OpenSearch\ \ domain has a public endpoint and is not deployed within a VPC.\"\n remediationMessage:\ \ \"Deploy the OpenSearch domain within a VPC to restrict access.\"\n check:\n\ \ NOT_EMPTY:\n arg: \n EXTRACT: \"CA10__endpoint__c\"\ \ \n - status: \"COMPLIANT\"\n currentStateMessage: \"The OpenSearch\ \ domain is deployed within a VPC.\"\n check:\n NOT_EMPTY:\n \ \ arg: \n EXTRACT: \"CA10__vpcEndpoints__c\" \notherwise:\n\ \ status: \"UNDETERMINED\"\n currentStateMessage: \"Unexpected values in the\ \ fields.\"\n" - path: /ce/ca/aws/opensearch/domain-vpc-endpoint/test-data.json md5Hash: EFC1549996BB4EEE4C88404DF7982836 content: |- [ { "expectedResult": { "status": "DISAPPEARED", "conditionIndex": "99", "conditionText": "isDisappeared(CA10__disappearanceTime__c)", "runtimeError": null }, "context": { "snapshotTime": "2025-11-05T23:51:16Z" }, "CA10__disappearanceTime__c": "2025-08-17T07:38:43Z", "CA10__endpoint__c": "", "CA10__vpcEndpoints__c": "vpcEndpoints", "Id": "test1" }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "299", "conditionText": "extract('CA10__endpoint__c').isNotEmpty()", "runtimeError": null }, "context": { "snapshotTime": "2025-11-05T23:51:16Z" }, "CA10__disappearanceTime__c": null, "CA10__endpoint__c": "endpoint", "CA10__vpcEndpoints__c": "", "Id": "test2" }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "399", "conditionText": "extract('CA10__vpcEndpoints__c').isNotEmpty()", "runtimeError": null }, "context": { "snapshotTime": "2025-11-05T23:51:16Z" }, "CA10__disappearanceTime__c": null, "CA10__endpoint__c": "", "CA10__vpcEndpoints__c": "vpcEndpoints", "Id": "test3" } ] - path: /types/CA10__CaAwsElasticsearchDomain__c/object.extracts.yaml md5Hash: C9B19E0A5971D32C19DFC4DEEA0D39EC content: | --- extracts: # Values: true | false (TEXT). Not nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__created__c" value: FIELD: path: "CA10__created__c" # Values: true | false (TEXT). Not nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__serviceSoftwareUpdateAvailable__c" value: FIELD: path: "CA10__serviceSoftwareUpdateAvailable__c" undeterminedIf: isEmpty: "The service software update status is not populated in the CMDB." # Values: true | false (TEXT). Not nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__advancedSecurityEnabled__c" value: FIELD: path: "CA10__advancedSecurityEnabled__c" undeterminedIf: isEmpty: "The fine-grained access control setting is not populated in the CMDB." # Checkbox - name: "CA10__encryptionAtRestEnabled__c" value: FIELD: path: "CA10__encryptionAtRestEnabled__c" # Nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__endpoint__c" value: FIELD: path: "CA10__endpoint__c" # Nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__vpcEndpoints__c" value: FIELD: path: "CA10__vpcEndpoints__c" # Checkbox - name: "CA10__nodeToNodeEncryptionEnabled__c" value: FIELD: path: "CA10__nodeToNodeEncryptionEnabled__c" # Nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__logPublishingOptionsJson__c" value: FIELD: returnType: "BYTES" path: "CA10__logPublishingOptionsJson__c" - name: "caJsonFrom__logPublishingOptionsJson__c" value: JSON_FROM: arg: EXTRACT: "CA10__logPublishingOptionsJson__c" undeterminedIf: isInvalid: "Log Publishing Options JSON is invalid." # Not nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__clusterConfigInstanceCount__c" value: FIELD: path: "CA10__clusterConfigInstanceCount__c" # Not nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__clusterConfigZoneAwarenessEnabled__c" value: FIELD: path: "CA10__clusterConfigZoneAwarenessEnabled__c" # Nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__clusterConfigDedicatedMasterEnabled__c" value: FIELD: path: "CA10__clusterConfigDedicatedMasterEnabled__c" # Nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__clusterConfigDedicatedMasterCount__c" value: FIELD: path: "CA10__clusterConfigDedicatedMasterCount__c" # Nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__endpointOptionsEnforceHttps__c" value: FIELD: path: "CA10__endpointOptionsEnforceHttps__c" # Nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__endpointOptionsTlsSecurityPolicy__c" value: FIELD: path: "CA10__endpointOptionsTlsSecurityPolicy__c" 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" : "299", "conditionText" : "extract('CA10__endpoint__c').isNotEmpty()", "runtimeError" : null } }, { "Id" : "test3", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "399", "conditionText" : "extract('CA10__vpcEndpoints__c').isNotEmpty()", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsElasticsearchDomain__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-11-05T23:51:16Z") }, "CA10__disappearanceTime__c" : new Date("2025-08-17T07:38:43Z"), "CA10__endpoint__c" : "", "CA10__vpcEndpoints__c" : "vpcEndpoints", "Id" : "test1" }, { "context" : { "snapshotTime" : new Date("2025-11-05T23:51:16Z") }, "CA10__endpoint__c" : "endpoint", "CA10__vpcEndpoints__c" : "", "Id" : "test2" }, { "context" : { "snapshotTime" : new Date("2025-11-05T23:51:16Z") }, "CA10__endpoint__c" : "", "CA10__vpcEndpoints__c" : "vpcEndpoints", "Id" : "test3" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsElasticsearchDomain__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__endpoint__c STRING, CA10__vpcEndpoints__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__endpoint__c; } return this.out; }; function extract6() { if (!this.out) { this.out = obj.CA10__vpcEndpoints__c; } return this.out; }; references1.push('Endpoint [obj.CA10__endpoint__c]: ' + obj.CA10__endpoint__c); references1.push('VPC Endpoints [obj.CA10__vpcEndpoints__c]: ' + obj.CA10__vpcEndpoints__c); if (TextLib.isEmpty(extract3.call(extract3)) && TextLib.isEmpty(extract6.call(extract6))) { return {status: 'UNDETERMINED', conditionIndex: 199, conditionText: "extract('CA10__endpoint__c').isEmpty() && extract('CA10__vpcEndpoints__c').isEmpty()", currentStateMessage: "Unable to determine the OpenSearch domain endpoint configuration.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[2], conditionIndex:[200..299] function extract9() { if (!this.out) { this.out = obj.CA10__endpoint__c; } return this.out; }; if (TextLib.isNotEmpty(extract9.call(extract9))) { return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "extract('CA10__endpoint__c').isNotEmpty()", currentStateMessage: "The OpenSearch domain has a public endpoint and is not deployed within a VPC.", currentStateReferences: references1.join('\n'), remediation: "Deploy the OpenSearch domain within a VPC to restrict access.", runtimeError: null}; } // condition[3], conditionIndex:[300..399] function extract12() { if (!this.out) { this.out = obj.CA10__vpcEndpoints__c; } return this.out; }; if (TextLib.isNotEmpty(extract12.call(extract12))) { return {status: 'COMPLIANT', conditionIndex: 399, conditionText: "extract('CA10__vpcEndpoints__c').isNotEmpty()", currentStateMessage: "The OpenSearch domain is deployed within a VPC.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'UNDETERMINED', conditionIndex: 400, conditionText: "otherwise", currentStateMessage: "Unexpected values in the fields.", 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__endpoint__c AS CA10__endpoint__c, sObject.CA10__vpcEndpoints__c AS CA10__vpcEndpoints__c, sObject.Id AS Id, process_CA10__CaAwsElasticsearchDomain__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__endpoint__c AS CA10__endpoint__c, sObject.CA10__vpcEndpoints__c AS CA10__vpcEndpoints__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAwsElasticsearchDomain__c()) AS sObject ) sObject ON sObject.Id = expectedResult.Id;