---
policy: /ce/ca/google/vpc/network-egress-deny-rule
logic: /ce/ca/google/vpc/network-egress-deny-rule/prod.logic.yaml
executionTime: 2025-10-25T12:02:57.959715266Z
generationMs: 59
executionMs: 932
rows:
  - id: '001'
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 199
      actual: 199
    conditionText:
      expected: CA10__Google_GCE_Firewall_Rules__r.has(COMPLIANT)
      actual: CA10__Google_GCE_Firewall_Rules__r.has(COMPLIANT)
    runtimeError: {}
  - id: '002'
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 200
      actual: 200
    conditionText:
      expected: otherwise
      actual: otherwise
    runtimeError: {}
  - id: '003'
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 200
      actual: 200
    conditionText:
      expected: otherwise
      actual: otherwise
    runtimeError: {}
  - id: '004'
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 200
      actual: 200
    conditionText:
      expected: otherwise
      actual: otherwise
    runtimeError: {}
  - id: '005'
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 200
      actual: 200
    conditionText:
      expected: otherwise
      actual: otherwise
    runtimeError: {}
usedFiles:
  - path: /ce/ca/google/vpc/network-egress-deny-rule/policy.yaml
    md5Hash: 52AD599C9EFB62FE62603B3B23D0F7B6
    content: "---\nnames: \n  full: \"Google GCE Network has no egress deny Firewall\
      \ Rule\"\n  contextual: \"GCE Network has no egress deny Firewall Rule\"\ndescription:\
      \ \"Ensure that every VPC Network includes at least one egress firewall\\\n\
      \  \\ rule with a deny action. Implementing a default-deny egress policy enforces\\\
      \n  \\ the principle of least privilege by controlling and restricting outbound\
      \ traffic from the network.\"\ntype: \"COMPLIANCE_POLICY\"\ncategories:\n  -\
      \ \"SECURITY\"\nframeworkMappings:\n  - \"/frameworks/pci-dss-v3.2.1/07/02\"\
      \n  - \"/frameworks/cloudaware/resource-security/secure-access\"\n"
  - path: /ce/ca/google/vpc/network-egress-deny-rule/prod.logic.yaml
    md5Hash: 1F49AAD133AC39E856CAE4554682CA4A
    content: |-
      ---

      inputType: "CA10__CaGoogleGceNetwork__c"
      testData:
        - file: "test-data.json"
      conditions:
        - status: "COMPLIANT"
          currentStateMessage: "The Network has an Egress deny rule."
          check:
            RELATED_LIST_HAS:
              status: "COMPLIANT"
              relationshipName: "CA10__Google_GCE_Firewall_Rules__r"
      otherwise:
        status: "INCOMPLIANT"
        currentStateMessage: "The Network has no egress GCE Firewall Rule which denies unwanted outbound traffic."
        remediationMessage: "Set an Egress deny rule."
      relatedLists:
        - relationshipName: "CA10__Google_GCE_Firewall_Rules__r"
          importExtracts:
            - file: "/types/CA10__CaGoogleGceFirewallRule__c/object.extracts.yaml"
          conditions:
            - status: "COMPLIANT"
              currentStateMessage: "Egress deny rule is set."
              check:
                AND:
                  args:
                    - IS_EQUAL:
                        left:
                          EXTRACT: "CA10__direction__c"
                        right:
                          TEXT: "EGRESS"
                    - IS_EQUAL:
                        left:
                          EXTRACT: "CA10__destinationRanges__c"
                        right:
                          TEXT: "0.0.0.0/0"
                    - GREATER_THAN:
                        left:
                          JSON_QUERY_NUMBER:
                            arg:
                              EXTRACT: "caJsonFrom__deniedProtocolsPortsJson__c"
                            expression: "length(ports[?((protocol=='all') || (startPort=='null' && endPort=='null'))])"
                            undeterminedIf:
                              evaluationError: "The JSON query failed."
                              resultTypeMismatch: "The JSON query did not return number type."
                        right:
                          NUMBER: 0.0
          otherwise:
            status: "INCOMPLIANT"
            currentStateMessage: "Egress deny rule not set."
            remediationMessage: "Set Egress deny rule."
  - path: /ce/ca/google/vpc/network-egress-deny-rule/test-data.json
    md5Hash: A36D53AC9533AAFDEC9296B38EC1070F
    content: |
      [
        {
          "expectedResult": {
            "status": "COMPLIANT",
            "conditionIndex": "199",
            "conditionText": "CA10__Google_GCE_Firewall_Rules__r.has(COMPLIANT)",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2025-09-14T18:12:05Z" },
          "Id": "001",
          "CA10__disappearanceTime__c": null,
          "CA10__Google_GCE_Firewall_Rules__r": [
            {
              "Id": "aa1",
              "CA10__disappearanceTime__c": null,
              "CA10__direction__c": "EGRESS",
              "CA10__destinationRanges__c": "0.0.0.0/0",
              "CA10__deniedProtocolsPortsJson__c": "{\"ports\":[{\"protocol\":\"all\",\"startPort\":\"ALL\",\"endPort\":\"ALL\"}]}",
              "CA10__gceNetwork__c": "001"
            }
          ]
        },
        {
          "expectedResult": {
            "status": "INCOMPLIANT",
            "conditionIndex": "200",
            "conditionText": "otherwise",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2025-09-14T18:12:05Z" },
          "Id": "002",
          "CA10__disappearanceTime__c": null,
          "CA10__Google_GCE_Firewall_Rules__r": [
            {
              "Id": "ab1",
              "CA10__disappearanceTime__c": null,
              "CA10__direction__c": "INGRESS",
              "CA10__destinationRanges__c": "0.0.0.0/0",
              "CA10__deniedProtocolsPortsJson__c": "{\"ports\":[{\"protocol\":\"all\",\"startPort\":\"ALL\",\"endPort\":\"ALL\"}]}",
              "CA10__gceNetwork__c": "002"
            }
          ]
        },
        {
          "expectedResult": {
            "status": "INCOMPLIANT",
            "conditionIndex": "200",
            "conditionText": "otherwise",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2025-09-14T18:12:05Z" },
          "Id": "003",
          "CA10__disappearanceTime__c": null,
          "CA10__Google_GCE_Firewall_Rules__r": [
            {
              "Id": "ac1",
              "CA10__disappearanceTime__c": null,
              "CA10__direction__c": "EGRESS",
              "CA10__destinationRanges__c": "10.40.201.2/32",
              "CA10__deniedProtocolsPortsJson__c": "{\"ports\":[{\"protocol\":\"all\",\"startPort\":\"ALL\",\"endPort\":\"ALL\"}]}",
              "CA10__gceNetwork__c": "003"
            }
          ]
        },
        {
          "expectedResult": {
            "status": "INCOMPLIANT",
            "conditionIndex": "200",
            "conditionText": "otherwise",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2025-09-14T18:12:05Z" },
          "Id": "004",
          "CA10__disappearanceTime__c": null,
          "CA10__Google_GCE_Firewall_Rules__r": [
            {
              "Id": "ad1",
              "CA10__disappearanceTime__c": null,
              "CA10__direction__c": "EGRESS",
              "CA10__destinationRanges__c": "0.0.0.0/0",
              "CA10__deniedProtocolsPortsJson__c": "{\"ports\":[]}}",
              "CA10__gceNetwork__c": "004"
            }
          ]
        },
        {
          "expectedResult": {
            "status": "INCOMPLIANT",
            "conditionIndex": "200",
            "conditionText": "otherwise",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2025-09-14T18:12:05Z" },
          "Id": "005",
          "CA10__disappearanceTime__c": null,
          "CA10__Google_GCE_Firewall_Rules__r": []
        }
      ]
  - path: /types/CA10__CaGoogleGceFirewallRule__c/object.extracts.yaml
    md5Hash: AE08F20196B487A130FB166DA77692D3
    content: "---\nextracts:\n  - name: \"CA10__direction__c\"\n    value: \n    \
      \  FIELD:\n        path: \"CA10__direction__c\"\n        undeterminedIf:\n \
      \        isEmpty: \"Direction is not populated yet.\"\n  - name: \"CA10__sourceRanges__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__sourceRanges__c\"\n     \
      \   undeterminedIf:\n          isEmpty: \"Source ranges are not populated yet.\"\
      \n  - name: \"CA10__allowedProtocolsPorts__c\"\n    value: \n      FIELD:\n\
      \        path: \"CA10__allowedProtocolsPorts__c\"\n        undeterminedIf:\n\
      \          isEmpty: \"Allowed protocol ports are not populated yet.\"\n# 22\
      \ port variants: tcp: 22 / tcp: 22, 80 / tcp: 1-65535\n  - name: \"caJsonFrom__allowedProtocolsPortsJson__c\"\
      \n    value:\n      JSON_FROM:\n        arg:\n          FIELD: \n          \
      \  path: \"CA10__allowedProtocolsPortsJson__c\"\n            returnType: BYTES\n\
      \        undeterminedIf:\n          isInvalid: \"Allowed protocol ports JSON\
      \ is invalid.\"\n          isEmpty: \"Allowed protocol ports JSON is empty.\"\
      \n  - name: \"caJsonFrom__deniedProtocolsPortsJson__c\"\n    value:\n      JSON_FROM:\n\
      \        arg:\n          FIELD: \n            path: \"CA10__deniedProtocolsPortsJson__c\"\
      \n            returnType: BYTES\n        undeterminedIf:\n          isInvalid:\
      \ \"Denied protocol ports JSON is invalid.\"\n          isEmpty: \"Denied protocol\
      \ ports JSON is empty.\"\n  - name: \"CA10__destinationRanges__c\"\n    value:\
      \ \n      FIELD:\n        path: \"CA10__destinationRanges__c\"\n        undeterminedIf:\n\
      \          isEmpty: \"Destination ranges are not populated yet.\"\n  - name:\
      \ \"CA10__logState__c\"\n    value: \n      FIELD:\n        path: \"CA10__logState__c\"\
      \n        undeterminedIf:\n         isEmpty: \"Logging status undetermined.\"\
      \n"
script: |-
  CREATE TEMP FUNCTION mock_ExpectedResult()
  RETURNS ARRAY<STRUCT<
          Id STRING,
          expectedResult STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, runtimeError STRING>
      >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "Id" : "001",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : "199",
      "conditionText" : "CA10__Google_GCE_Firewall_Rules__r.has(COMPLIANT)",
      "runtimeError" : null
    }
  }, {
    "Id" : "002",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "200",
      "conditionText" : "otherwise",
      "runtimeError" : null
    }
  }, {
    "Id" : "003",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "200",
      "conditionText" : "otherwise",
      "runtimeError" : null
    }
  }, {
    "Id" : "004",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "200",
      "conditionText" : "otherwise",
      "runtimeError" : null
    }
  }, {
    "Id" : "005",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "200",
      "conditionText" : "otherwise",
      "runtimeError" : null
    }
  } ];
  """;

  CREATE TEMP FUNCTION mock_CA10__CaGoogleGceNetwork__c()
  RETURNS ARRAY<STRUCT<
      CA10__disappearanceTime__c TIMESTAMP,
      Id STRING,
      context STRUCT<
          snapshotTime TIMESTAMP
      >
  >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "context" : {
      "snapshotTime" : new Date("2025-09-14T18:12:05Z")
    },
    "Id" : "001"
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-14T18:12:05Z")
    },
    "Id" : "002"
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-14T18:12:05Z")
    },
    "Id" : "003"
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-14T18:12:05Z")
    },
    "Id" : "004"
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-14T18:12:05Z")
    },
    "Id" : "005"
  } ];
  """;

  CREATE TEMP FUNCTION mock_CA10__CaGoogleGceFirewallRule__c()
  RETURNS ARRAY<STRUCT<
      CA10__disappearanceTime__c TIMESTAMP,
      CA10__direction__c STRING,
      CA10__destinationRanges__c STRING,
      CA10__deniedProtocolsPortsJson__c STRING,
      CA10__gceNetwork__c STRING,
      Id STRING,
      context STRUCT<
          snapshotTime TIMESTAMP
      >
  >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "context" : {
      "snapshotTime" : new Date("2025-09-14T18:12:05Z")
    },
    "CA10__direction__c" : "EGRESS",
    "CA10__destinationRanges__c" : "0.0.0.0/0",
    "CA10__deniedProtocolsPortsJson__c" : "{\"ports\":[{\"protocol\":\"all\",\"startPort\":\"ALL\",\"endPort\":\"ALL\"}]}",
    "CA10__gceNetwork__c" : "001",
    "Id" : "aa1"
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-14T18:12:05Z")
    },
    "CA10__direction__c" : "INGRESS",
    "CA10__destinationRanges__c" : "0.0.0.0/0",
    "CA10__deniedProtocolsPortsJson__c" : "{\"ports\":[{\"protocol\":\"all\",\"startPort\":\"ALL\",\"endPort\":\"ALL\"}]}",
    "CA10__gceNetwork__c" : "002",
    "Id" : "ab1"
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-14T18:12:05Z")
    },
    "CA10__direction__c" : "EGRESS",
    "CA10__destinationRanges__c" : "10.40.201.2/32",
    "CA10__deniedProtocolsPortsJson__c" : "{\"ports\":[{\"protocol\":\"all\",\"startPort\":\"ALL\",\"endPort\":\"ALL\"}]}",
    "CA10__gceNetwork__c" : "003",
    "Id" : "ac1"
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-14T18:12:05Z")
    },
    "CA10__direction__c" : "EGRESS",
    "CA10__destinationRanges__c" : "0.0.0.0/0",
    "CA10__deniedProtocolsPortsJson__c" : "{\"ports\":[]}}",
    "CA10__gceNetwork__c" : "004",
    "Id" : "ad1"
  } ];
  """;

  CREATE TEMP FUNCTION process_CA10__CaGoogleGceNetwork__c(
      obj STRUCT<
          CA10__disappearanceTime__c TIMESTAMP,
          Id STRING,
          CA10__Google_GCE_Firewall_Rules__r ARRAY<STRUCT<
              CA10__disappearanceTime__c TIMESTAMP,
              CA10__direction__c STRING,
              CA10__destinationRanges__c STRING,
              CA10__deniedProtocolsPortsJson__c STRING,
              CA10__gceNetwork__c STRING,
              Id STRING,
              result STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, currentStateMessage STRING, currentStateReferences STRING, remediation STRING, runtimeError STRING>
          >>
      >,
      snapshotTime TIMESTAMP
  )
  RETURNS STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, currentStateMessage STRING, currentStateReferences STRING, remediation STRING, runtimeError STRING>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
      var references1 = [];
      // condition[0], conditionIndex:[0..99]
      references1.push('Deleted From Google [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__Google_GCE_Firewall_Rules__r_COMPLIANT2 = 0;
      if (obj.CA10__Google_GCE_Firewall_Rules__r != null) {
          for (var i3 = 0; i3 < obj.CA10__Google_GCE_Firewall_Rules__r.length; i3++) {
              if (typeof(obj.CA10__Google_GCE_Firewall_Rules__r[i3].status) !== 'undefined') {
                  if (obj.CA10__Google_GCE_Firewall_Rules__r[i3].status == 'COMPLIANT') {
                      count_CA10__Google_GCE_Firewall_Rules__r_COMPLIANT2 += obj.CA10__Google_GCE_Firewall_Rules__r[i3].count;
                  }
              } else  {
                  if (obj.CA10__Google_GCE_Firewall_Rules__r[i3].result.status == 'COMPLIANT') {
                      count_CA10__Google_GCE_Firewall_Rules__r_COMPLIANT2 += 1;
                  }
              }
          }
      }
      // condition[1], conditionIndex:[100..199]
      references1.push('Related list [CA10__Google_GCE_Firewall_Rules__r] ' + (count_CA10__Google_GCE_Firewall_Rules__r_COMPLIANT2 > 0 ? 'has' : 'does not have') + ' objects in COMPLIANT status');
      if (count_CA10__Google_GCE_Firewall_Rules__r_COMPLIANT2 > 0) {
          return {status: 'COMPLIANT', conditionIndex: 199, conditionText: "CA10__Google_GCE_Firewall_Rules__r.has(COMPLIANT)", currentStateMessage: "The Network has an Egress deny rule.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      return {status: 'INCOMPLIANT', conditionIndex: 200, conditionText: "otherwise", currentStateMessage: "The Network has no egress GCE Firewall Rule which denies unwanted outbound traffic.", currentStateReferences: references1.join('\n'), remediation: "Set an Egress deny rule.", runtimeError: null};
  """;

  CREATE TEMP FUNCTION process_CA10__Google_GCE_Firewall_Rules__r(
      obj STRUCT<
          CA10__disappearanceTime__c TIMESTAMP,
          CA10__direction__c STRING,
          CA10__destinationRanges__c STRING,
          CA10__deniedProtocolsPortsJson__c STRING,
          CA10__gceNetwork__c STRING,
          Id STRING
      >,
      snapshotTime TIMESTAMP
  )
  RETURNS STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, currentStateMessage STRING, currentStateReferences STRING, remediation STRING, runtimeError STRING>
  DETERMINISTIC
  LANGUAGE js
  OPTIONS (library=['gs://compliance-platform-public/jmespath.min.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 Google [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 fieldChecked4() {
          if (TextLib.isEmpty(obj.CA10__direction__c)) {
              throw new Error("UNDETERMINED condition:101", {cause: {status: 'UNDETERMINED', conditionIndex: 101, conditionText: "CA10__direction__c.isEmpty()", currentStateMessage: "Direction is not populated yet.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10__direction__c;
      }
      function extract3() { if (!this.out) { this.out = fieldChecked4(); } return this.out; };
      function fieldChecked7() {
          if (TextLib.isEmpty(obj.CA10__destinationRanges__c)) {
              throw new Error("UNDETERMINED condition:102", {cause: {status: 'UNDETERMINED', conditionIndex: 102, conditionText: "CA10__destinationRanges__c.isEmpty()", currentStateMessage: "Destination ranges are not populated yet.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10__destinationRanges__c;
      }
      function extract6() { if (!this.out) { this.out = fieldChecked7(); } return this.out; };
      function comparison8() {
          var comparisonLeft14 = jsonQueryChecked9();
          return comparisonLeft14 != null && 0.0 != null && comparisonLeft14 > 0.0;
      }
      function jsonQueryChecked9() {
          var input = extract11.call(extract11);
          var out;
          try {
              out = jmespath.search(input, 'length(ports[?((protocol==\'all\') || (startPort==\'null\' && endPort==\'null\'))])');
          if (out != null && typeof out != 'number') {
              throw new Error("UNDETERMINED condition:105", {cause: {status: 'UNDETERMINED', conditionIndex: 105, conditionText: "extract('caJsonFrom__deniedProtocolsPortsJson__c').jsonQueryText('length(ports[?((protocol==\\'all\\') || (startPort==\\'null\\' && endPort==\\'null\\'))])').isResultTypeMismatch()", currentStateMessage: "The JSON query did not return number type.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          } catch (e) {
              throw new Error("UNDETERMINED condition:106", {cause: {status: 'UNDETERMINED', conditionIndex: 106, conditionText: "extract('caJsonFrom__deniedProtocolsPortsJson__c').jsonQueryText('length(ports[?((protocol==\\'all\\') || (startPort==\\'null\\' && endPort==\\'null\\'))])').isEvaluationFailed()", currentStateMessage: "The JSON query failed.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: e.message}});
          }
          return out;
      }
      function jsonChecked12() {
          var input = obj.CA10__deniedProtocolsPortsJson__c;
          if (TextLib.isEmpty(input)) {
              throw new Error("UNDETERMINED condition:103", {cause: {status: 'UNDETERMINED', conditionIndex: 103, conditionText: "CA10__deniedProtocolsPortsJson__c.asJson().isEmpty()", currentStateMessage: "Denied protocol ports JSON is empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          var out;
          try {
              out = JSON.parse(input);
          } catch (e) {
              throw new Error("UNDETERMINED condition:104", {cause: {status: 'UNDETERMINED', conditionIndex: 104, conditionText: "CA10__deniedProtocolsPortsJson__c.asJson().isInvalid()", currentStateMessage: "Denied protocol ports JSON is invalid.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: e.message}});
          }
          return out;
      }
      function extract11() { if (!this.out) { this.out = jsonChecked12(); } return this.out; };
      references1.push('Direction [obj.CA10__direction__c]: ' + obj.CA10__direction__c);
      references1.push('Destination Ranges [obj.CA10__destinationRanges__c]: ' + obj.CA10__destinationRanges__c);
      references1.push('Denied Protocols / Ports JSON [obj.CA10__deniedProtocolsPortsJson__c]: ' + obj.CA10__deniedProtocolsPortsJson__c);
      try {
          if (TextLib.equal(extract3.call(extract3), 'EGRESS') && TextLib.equal(extract6.call(extract6), '0.0.0.0/0') && comparison8()) {
              return {status: 'COMPLIANT', conditionIndex: 199, conditionText: "extract('CA10__direction__c') == 'EGRESS' && extract('CA10__destinationRanges__c') == '0.0.0.0/0' && extract('caJsonFrom__deniedProtocolsPortsJson__c').jsonQueryText('length(ports[?((protocol==\\'all\\') || (startPort==\\'null\\' && endPort==\\'null\\'))])') > number(0.0)", currentStateMessage: "Egress deny rule is set.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
          }
      } catch (err) {
          if (err.cause && err.cause.status) { return err.cause; } else { throw err; }
      }
      return {status: 'INCOMPLIANT', conditionIndex: 200, conditionText: "otherwise", currentStateMessage: "Egress deny rule not set.", currentStateReferences: references1.join('\n'), remediation: "Set Egress deny rule.", 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__Google_GCE_Firewall_Rules__r`.arr AS CA10__Google_GCE_Firewall_Rules__r,
          process_CA10__CaGoogleGceNetwork__c(
              STRUCT(
                  sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
                  sObject.Id AS Id,
                  `CA10__Google_GCE_Firewall_Rules__r`.arr AS CA10__Google_GCE_Firewall_Rules__r
              ),
              sObject.context.snapshotTime
          ) as result
      FROM UNNEST(mock_CA10__CaGoogleGceNetwork__c()) AS sObject
      LEFT JOIN (
          SELECT
              sObject.CA10__gceNetwork__c,
              ARRAY_AGG(
                  STRUCT(
                      sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
                      sObject.CA10__direction__c AS CA10__direction__c,
                      sObject.CA10__destinationRanges__c AS CA10__destinationRanges__c,
                      sObject.CA10__deniedProtocolsPortsJson__c AS CA10__deniedProtocolsPortsJson__c,
                      sObject.CA10__gceNetwork__c AS CA10__gceNetwork__c,
                      sObject.Id AS Id,
                      process_CA10__Google_GCE_Firewall_Rules__r(
                          STRUCT(
                              sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
                              sObject.CA10__direction__c AS CA10__direction__c,
                              sObject.CA10__destinationRanges__c AS CA10__destinationRanges__c,
                              sObject.CA10__deniedProtocolsPortsJson__c AS CA10__deniedProtocolsPortsJson__c,
                              sObject.CA10__gceNetwork__c AS CA10__gceNetwork__c,
                              sObject.Id AS Id
                          ),
                          sObject.context.snapshotTime
                      ) as result
                  )
              ) AS arr
          FROM UNNEST(mock_CA10__CaGoogleGceFirewallRule__c()) AS sObject
          GROUP BY sObject.CA10__gceNetwork__c
      ) AS `CA10__Google_GCE_Firewall_Rules__r`
          ON sObject.Id = `CA10__Google_GCE_Firewall_Rules__r`.CA10__gceNetwork__c
  ) sObject ON sObject.Id = expectedResult.Id;
