--- policy: /ce/ca/aws/eks/cluster-allows-unrestricted-public-traffic logic: /ce/ca/aws/eks/cluster-allows-unrestricted-public-traffic/prod.logic.yaml executionTime: 2026-02-10T22:32:50.443623741Z generationMs: 52 executionMs: 748 rows: - id: test1 match: true status: expected: DISAPPEARED actual: DISAPPEARED conditionIndex: expected: 99 actual: 99 conditionText: expected: isDisappeared(CA10A1__disappearanceTime__c) actual: isDisappeared(CA10A1__disappearanceTime__c) runtimeError: {} - id: test2 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 199 actual: 199 conditionText: expected: extract('CA10A1__endpointPublicAccess__c') == 'Disabled' actual: extract('CA10A1__endpointPublicAccess__c') == 'Disabled' runtimeError: {} - id: test3 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 299 actual: 299 conditionText: expected: extract('CA10A1__publicAccessCidrs__c').contains('0.0.0.0/0') actual: extract('CA10A1__publicAccessCidrs__c').contains('0.0.0.0/0') runtimeError: {} usedFiles: - path: /ce/ca/aws/eks/cluster-allows-unrestricted-public-traffic/policy.yaml md5Hash: F24E676CD3EA07DFA900985F59736184 content: "names:\n full: \"AWS EKS Cluster allows unrestricted public traffic\"\ \n contextual: \"Cluster allows unrestricted public traffic\"\ndescription:\ \ >\n Ensure that Amazon EKS clusters are configured to restrict public access\ \ to their \n Kubernetes API server endpoint to specific CIDR blocks. Unrestricted\ \ public \n access can expose the cluster to unauthorized access and potential\ \ attacks.\ncategories:\n - \"SECURITY\"\ntype: \"COMPLIANCE_POLICY\"\nframeworkMappings:\n\ \ - \"/frameworks/cloudaware/resource-security/public-and-anonymous-access\"\ \n - \"/frameworks/aws-fsbp-v1.0.0/eks/01\"\nsimilarPolicies:\n internal:\n\ \ - \"dec-x-cffc7d8e\"" - path: /ce/ca/aws/eks/cluster-allows-unrestricted-public-traffic/prod.logic.yaml md5Hash: 6B7B07C9A61C80CFCBDBC9740DF50FDF content: "inputType: \"CA10A1__CaAwsEksCluster__c\"\nimportExtracts:\n - file:\ \ \"/types/CA10A1__CaAwsEksCluster__c/object.extracts.yaml\"\ntestData:\n -\ \ file: \"test-data.json\"\nconditions:\n - status: \"COMPLIANT\"\n currentStateMessage:\ \ \"The cluster endpoint public access is disabled.\"\n check:\n IS_EQUAL:\n\ \ left:\n EXTRACT: \"CA10A1__endpointPublicAccess__c\"\n \ \ right:\n TEXT: \"Disabled\"\n - status: \"INCOMPLIANT\"\n \ \ currentStateMessage: \"The cluster endpoint public access allows access from\ \ all IP addresses.\"\n remediationMessage: \"Limit public endpoint access\ \ to approved CIDR ranges.\"\n check:\n CONTAINS:\n arg:\n \ \ EXTRACT: \"CA10A1__publicAccessCidrs__c\"\n search:\n \ \ TEXT: \"0.0.0.0/0\"\notherwise:\n status: \"COMPLIANT\" \n currentStateMessage:\ \ \"The cluster endpoint public access does not allow access from all IP addresses.\"\ \n" - path: /ce/ca/aws/eks/cluster-allows-unrestricted-public-traffic/test-data.json md5Hash: 3C84D34B0D3EB564C5709D99AB649540 content: |- [ { "expectedResult": { "status": "DISAPPEARED", "conditionIndex": "99", "conditionText": "isDisappeared(CA10A1__disappearanceTime__c)", "runtimeError": null }, "context": { "snapshotTime": "2025-05-22T08:12:49Z" }, "Id": "test1", "CA10A1__disappearanceTime__c": "2025-05-22T08:12:49Z", "CA10A1__endpointPublicAccess__c": "Enabled", "CA10A1__publicAccessCidrs__c": "0.0.0.0/0" }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "199", "conditionText": "extract('CA10A1__endpointPublicAccess__c') == 'Disabled'", "runtimeError": null }, "context": { "snapshotTime": "2025-05-22T08:12:49Z" }, "Id": "test2", "CA10A1__disappearanceTime__c": null, "CA10A1__endpointPublicAccess__c": "Disabled", "CA10A1__publicAccessCidrs__c": "0.0.0.0/0" }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "299", "conditionText": "extract('CA10A1__publicAccessCidrs__c').contains('0.0.0.0/0')", "runtimeError": null }, "context": { "snapshotTime": "2025-05-22T08:12:49Z" }, "Id": "test3", "CA10A1__disappearanceTime__c": null, "CA10A1__endpointPublicAccess__c": "Enabled", "CA10A1__publicAccessCidrs__c": "0.0.0.0/0" } ] - path: /types/CA10A1__CaAwsEksCluster__c/object.extracts.yaml md5Hash: 40E423BD15F099D7D2B8AE19BF4D325E content: "---\nextracts:\n#Values: Enabled | Disabled. Not Nullable.\n - name:\ \ CA10A1__endpointPublicAccess__c\n value: \n FIELD:\n path:\ \ CA10A1__endpointPublicAccess__c\n undeterminedIf:\n noAccessDelegate:\n\ \ path: CA10A1__endpointPublicAccess__c\n currentStateMessage:\ \ \"Endpoint Public Access cannot be empty. Possible permission issues with\ \ eks:DescribeCluster.\"\n#LONG_TEXT_AREA with IP addresses divided by \\n.\ \ Nullable\n - name: CA10A1__publicAccessCidrs__c\n value: \n FIELD:\n\ \ path: CA10A1__publicAccessCidrs__c\n#Values: array of strings\n \ \ # api: Enabled\\n\n # audit: Enabled\\n\n # authenticator: Enabled\\\ n\n # controllerManager: Enabled\\n\n # scheduler: Enabled\\n\n -\ \ name: CA10A1__logging__c\n value: \n FIELD:\n path: CA10A1__logging__c\n\ \ undeterminedIf:\n noAccessDelegate:\n path: CA10A1__logging__c\n\ \ currentStateMessage: \"Cluster Logging cannot be empty. Possible\ \ permission issues with eks:DescribeCluster.\"\n - name: caSetFrom_logging__c\n\ \ value:\n SET_FROM:\n separator: \"\\n\"\n arg:\n \ \ EXTRACT: \"CA10A1__logging__c\"" script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "test1", "expectedResult" : { "status" : "DISAPPEARED", "conditionIndex" : "99", "conditionText" : "isDisappeared(CA10A1__disappearanceTime__c)", "runtimeError" : null } }, { "Id" : "test2", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "199", "conditionText" : "extract('CA10A1__endpointPublicAccess__c') == 'Disabled'", "runtimeError" : null } }, { "Id" : "test3", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "299", "conditionText" : "extract('CA10A1__publicAccessCidrs__c').contains('0.0.0.0/0')", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10A1__CaAwsEksCluster__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-05-22T08:12:49Z") }, "CA10A1__disappearanceTime__c" : new Date("2025-05-22T08:12:49Z"), "CA10A1__endpointPublicAccess__c" : "Enabled", "CA10A1__publicAccessCidrs__c" : "0.0.0.0/0", "Id" : "test1" }, { "context" : { "snapshotTime" : new Date("2025-05-22T08:12:49Z") }, "CA10A1__endpointPublicAccess__c" : "Disabled", "CA10A1__publicAccessCidrs__c" : "0.0.0.0/0", "Id" : "test2" }, { "context" : { "snapshotTime" : new Date("2025-05-22T08:12:49Z") }, "CA10A1__endpointPublicAccess__c" : "Enabled", "CA10A1__publicAccessCidrs__c" : "0.0.0.0/0", "Id" : "test3" } ]; """; CREATE TEMP FUNCTION process_CA10A1__CaAwsEksCluster__c( obj STRUCT< CA10A1__disappearanceTime__c TIMESTAMP, CA10A1__endpointPublicAccess__c STRING, CA10A1__publicAccessCidrs__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 [CA10A1__disappearanceTime__c]: ' + obj.CA10A1__disappearanceTime__c); if (obj.CA10A1__disappearanceTime__c != null) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10A1__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.CA10A1__endpointPublicAccess__c)) { throw new Error("UNDETERMINED condition:101", {cause: {status: 'UNDETERMINED', conditionIndex: 101, conditionText: "CA10A1__endpointPublicAccess__c.delegatedTo(CA10A1__endpointPublicAccess__c).isEmpty()", currentStateMessage: "Endpoint Public Access cannot be empty. Possible permission issues with eks:DescribeCluster.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10A1__endpointPublicAccess__c; } function extract3() { if (!this.out) { this.out = fieldChecked4(); } return this.out; }; references1.push('Endpoint Public Access [obj.CA10A1__endpointPublicAccess__c]: ' + obj.CA10A1__endpointPublicAccess__c); try { if (TextLib.equal(extract3.call(extract3), 'Disabled')) { return {status: 'COMPLIANT', conditionIndex: 199, conditionText: "extract('CA10A1__endpointPublicAccess__c') == 'Disabled'", currentStateMessage: "The cluster endpoint public access is disabled.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[2], conditionIndex:[200..299] function extract6() { if (!this.out) { this.out = obj.CA10A1__publicAccessCidrs__c; } return this.out; }; references1.push('Public Access CIDRs [obj.CA10A1__publicAccessCidrs__c]: ' + obj.CA10A1__publicAccessCidrs__c); if (TextLib.contains(extract6.call(extract6), '0.0.0.0/0')) { return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "extract('CA10A1__publicAccessCidrs__c').contains('0.0.0.0/0')", currentStateMessage: "The cluster endpoint public access allows access from all IP addresses.", currentStateReferences: references1.join('\n'), remediation: "Limit public endpoint access to approved CIDR ranges.", runtimeError: null}; } return {status: 'COMPLIANT', conditionIndex: 300, conditionText: "otherwise", currentStateMessage: "The cluster endpoint public access does not allow access from all 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.CA10A1__disappearanceTime__c AS CA10A1__disappearanceTime__c, sObject.CA10A1__endpointPublicAccess__c AS CA10A1__endpointPublicAccess__c, sObject.CA10A1__publicAccessCidrs__c AS CA10A1__publicAccessCidrs__c, sObject.Id AS Id, process_CA10A1__CaAwsEksCluster__c( STRUCT( sObject.CA10A1__disappearanceTime__c AS CA10A1__disappearanceTime__c, sObject.CA10A1__endpointPublicAccess__c AS CA10A1__endpointPublicAccess__c, sObject.CA10A1__publicAccessCidrs__c AS CA10A1__publicAccessCidrs__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10A1__CaAwsEksCluster__c()) AS sObject ) sObject ON sObject.Id = expectedResult.Id;