---
policy: /ce/ca/aws/network-firewall/policy-default-stateless-action
logic: /ce/ca/aws/network-firewall/policy-default-stateless-action/prod.logic.yaml
executionTime: 2026-01-17T12:02:55.272052525Z
generationMs: 69
executionMs: 905
rows:
  - id: test1
    match: true
    status:
      expected: DISAPPEARED
      actual: DISAPPEARED
    conditionIndex:
      expected: 99
      actual: 99
    conditionText:
      expected: isDisappeared(CA10A2__disappearanceTime__c)
      actual: isDisappeared(CA10A2__disappearanceTime__c)
    runtimeError: {}
  - id: test2
    match: true
    status:
      expected: UNDETERMINED
      actual: UNDETERMINED
    conditionIndex:
      expected: 101
      actual: 101
    conditionText:
      expected: CA10A2__firewallPolicyStatus__c.delegatedTo(CA10A2__firewallPolicyStatus__c).isEmpty()
      actual: CA10A2__firewallPolicyStatus__c.delegatedTo(CA10A2__firewallPolicyStatus__c).isEmpty()
    runtimeError: {}
  - id: test3
    match: true
    status:
      expected: INAPPLICABLE
      actual: INAPPLICABLE
    conditionIndex:
      expected: 199
      actual: 199
    conditionText:
      expected: extract('CA10A2__firewallPolicyStatus__c') != 'ACTIVE'
      actual: extract('CA10A2__firewallPolicyStatus__c') != 'ACTIVE'
    runtimeError: {}
  - id: test4
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 299
      actual: 299
    conditionText:
      expected: extract('CA10A2__statelessDefaultActions__c').contains('aws:pass')
      actual: extract('CA10A2__statelessDefaultActions__c').contains('aws:pass')
    runtimeError: {}
  - id: test5
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 299
      actual: 299
    conditionText:
      expected: extract('CA10A2__statelessDefaultActions__c').contains('aws:pass')
      actual: extract('CA10A2__statelessDefaultActions__c').contains('aws:pass')
    runtimeError: {}
  - id: test6
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 499
      actual: 499
    conditionText:
      expected: "extract('CA10A2__statelessDefaultActions__c').asSetOfText('\\n').containsAny(setOfText(['aws:drop',\
        \ 'aws:forward_to_sfe'])) && extract('CA10A2__statelessFragmentDefaultActions__c').asSetOfText('\\\
        n').containsAny(setOfText(['aws:drop', 'aws:forward_to_sfe']))"
      actual: "extract('CA10A2__statelessDefaultActions__c').asSetOfText('\\n').containsAny(setOfText(['aws:drop',\
        \ 'aws:forward_to_sfe'])) && extract('CA10A2__statelessFragmentDefaultActions__c').asSetOfText('\\\
        n').containsAny(setOfText(['aws:drop', 'aws:forward_to_sfe']))"
    runtimeError: {}
  - id: test7
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 499
      actual: 499
    conditionText:
      expected: "extract('CA10A2__statelessDefaultActions__c').asSetOfText('\\n').containsAny(setOfText(['aws:drop',\
        \ 'aws:forward_to_sfe'])) && extract('CA10A2__statelessFragmentDefaultActions__c').asSetOfText('\\\
        n').containsAny(setOfText(['aws:drop', 'aws:forward_to_sfe']))"
      actual: "extract('CA10A2__statelessDefaultActions__c').asSetOfText('\\n').containsAny(setOfText(['aws:drop',\
        \ 'aws:forward_to_sfe'])) && extract('CA10A2__statelessFragmentDefaultActions__c').asSetOfText('\\\
        n').containsAny(setOfText(['aws:drop', 'aws:forward_to_sfe']))"
    runtimeError: {}
usedFiles:
  - path: /ce/ca/aws/network-firewall/policy-default-stateless-action/policy.yaml
    md5Hash: 46123524041C690D9397EA834C36E2EB
    content: "---\nnames:\n  full: \"AWS Network Firewall Policy Stateless Default\
      \ Action is not Drop or Forward\"\n  contextual: \"Policy Stateless Default\
      \ Action is not Drop or Forward\"\ndescription: >\n  Ensure that AWS Network\
      \ Firewall policies are configured to either drop packets \n  or forward them\
      \ to the stateful engine when they do not match any stateless rules. \n  Using\
      \ a default action of 'Pass' for unmatched packets can allow unauthorized \n\
      \  traffic to bypass deep packet inspection.\ntype: \"COMPLIANCE_POLICY\"\n\
      categories:\n  - \"RELIABILITY\"\nframeworkMappings:\n  - \"/frameworks/cloudaware/resource-reliability/system-configuration\"\
      \n  - \"/frameworks/aws-fsbp-v1.0.0/network-firewall/04\"\n  - \"/frameworks/aws-fsbp-v1.0.0/network-firewall/05\"\
      \nsimilarPolicies:\n  awsSecurityHub:\n    - name: \"[NetworkFirewall.4] The\
      \ default stateless action for Network Firewall policies should be drop or forward\
      \ for full packets\"\n      url: \"https://docs.aws.amazon.com/securityhub/latest/userguide/networkfirewall-controls.html#networkfirewall-4\"\
      \n    - name: \"[NetworkFirewall.5] The default stateless action for Network\
      \ Firewall policies should be drop or forward for fragmented packets\"\n   \
      \   url: \"https://docs.aws.amazon.com/securityhub/latest/userguide/networkfirewall-controls.html#networkfirewall-5\"\
      \n"
  - path: /ce/ca/aws/network-firewall/policy-default-stateless-action/prod.logic.yaml
    md5Hash: B58CDFF33BFC370BE23DDA0AEDD606E6
    content: |
      ---
      inputType: "CA10A2__CaAwsNetworkFirewallFirewallPolicy__c"
      importExtracts:
        - file: "/types/CA10A2__CaAwsNetworkFirewallFirewallPolicy__c/object.extracts.yaml"
      testData:
        - file: "test-data.json"
      conditions:
        - status: "INAPPLICABLE"
          currentStateMessage: "The Network Firewall Policy is not active."
          check:
            NOT_EQUAL:
              left:
                EXTRACT: "CA10A2__firewallPolicyStatus__c"
              right:
                TEXT: "ACTIVE"
        - status: "INCOMPLIANT"
          currentStateMessage: "The stateless default action is not set to Pass for full packets."
          remediationMessage: "Change the stateless default action to 'aws:drop' or\
            \ 'aws:forward_to_sfe' to ensure unintended traffic is not allowed."
          check:
            CONTAINS:
              arg:
                EXTRACT: "CA10A2__statelessDefaultActions__c"
              search:
                TEXT: "aws:pass"
        - status: "INCOMPLIANT"
          currentStateMessage: "The stateless default action is not set to Pass for fragmented packets."
          remediationMessage: "Change the stateless default action to 'aws:drop' or\
            \ 'aws:forward_to_sfe' to ensure unintended traffic is not allowed."
          check:
            CONTAINS:
              arg:
                EXTRACT: "CA10A2__statelessFragmentDefaultActions__c"
              search:
                TEXT: "aws:pass"
        - status: "COMPLIANT"
          currentStateMessage: "The stateless default action is set to Drop or Forward."
          check:
            AND:
              args:
                - CONTAINS_ANY:
                    arg:
                      SET_FROM:
                        separator: "\n"
                        arg:
                          EXTRACT: "CA10A2__statelessDefaultActions__c"
                    search:
                      SET:
                        itemType: "TEXT"
                        items:
                          - "aws:drop"
                          - "aws:forward_to_sfe"
                - CONTAINS_ANY:
                    arg:
                      SET_FROM:
                        separator: "\n"
                        arg:
                          EXTRACT: "CA10A2__statelessFragmentDefaultActions__c"
                    search:
                      SET:
                        itemType: "TEXT"
                        items:
                          - "aws:drop"
                          - "aws:forward_to_sfe"
      otherwise:
        status: "UNDETERMINED"
        currentStateMessage: "Unexpected values in the fields."
  - path: /ce/ca/aws/network-firewall/policy-default-stateless-action/test-data.json
    md5Hash: 5E8902B39EA2CD2BBACEF32ED359A252
    content: |-
      [
          {
              "CA10A2__disappearanceTime__c": "2026-01-15T10:42:39Z",
              "expectedResult": {
                  "runtimeError": null,
                  "conditionText": "isDisappeared(CA10A2__disappearanceTime__c)",
                  "conditionIndex": 99,
                  "status": "DISAPPEARED"
              },
              "context": {
                  "snapshotTime": "2026-01-15T10:42:39Z"
              },
              "CA10A2__statelessDefaultActions__c": "",
              "CA10A2__statelessFragmentDefaultActions__c": "",
              "Id": "test1",
              "CA10A2__firewallPolicyStatus__c": ""
          },
          {
              "CA10A2__disappearanceTime__c": null,
              "expectedResult": {
                  "runtimeError": null,
                  "conditionText": "CA10A2__firewallPolicyStatus__c.delegatedTo(CA10A2__firewallPolicyStatus__c).isEmpty()",
                  "conditionIndex": 101,
                  "status": "UNDETERMINED"
              },
              "context": {
                  "snapshotTime": "2026-01-15T10:42:39Z"
              },
              "CA10A2__statelessDefaultActions__c": "",
              "CA10A2__statelessFragmentDefaultActions__c": "",
              "Id": "test2",
              "CA10A2__firewallPolicyStatus__c": ""
          },
          {
              "CA10A2__disappearanceTime__c": null,
              "expectedResult": {
                  "runtimeError": null,
                  "conditionText": "extract('CA10A2__firewallPolicyStatus__c') != 'ACTIVE'",
                  "conditionIndex": 199,
                  "status": "INAPPLICABLE"
              },
              "context": {
                  "snapshotTime": "2026-01-15T10:42:39Z"
              },
              "CA10A2__statelessDefaultActions__c": "",
              "CA10A2__statelessFragmentDefaultActions__c": "",
              "Id": "test3",
              "CA10A2__firewallPolicyStatus__c": "ERROR"
          },
          {
              "CA10A2__disappearanceTime__c": null,
              "expectedResult": {
                  "runtimeError": null,
                  "conditionText": "extract('CA10A2__statelessDefaultActions__c').contains('aws:pass')",
                  "conditionIndex": 299,
                  "status": "INCOMPLIANT"
              },
              "context": {
                  "snapshotTime": "2026-01-15T10:42:39Z"
              },
              "CA10A2__statelessDefaultActions__c": "aws:pass",
              "CA10A2__statelessFragmentDefaultActions__c": "aws:pass",
              "Id": "test4",
              "CA10A2__firewallPolicyStatus__c": "ACTIVE"
          },
          {
              "CA10A2__disappearanceTime__c": null,
              "expectedResult": {
                  "runtimeError": null,
                  "conditionText": "extract('CA10A2__statelessDefaultActions__c').contains('aws:pass')",
                  "conditionIndex": 299,
                  "status": "INCOMPLIANT"
              },
              "context": {
                  "snapshotTime": "2026-01-15T10:42:39Z"
              },
              "CA10A2__statelessDefaultActions__c": "action\naws:pass",
              "CA10A2__statelessFragmentDefaultActions__c": "action\naws:pass",
              "Id": "test5",
              "CA10A2__firewallPolicyStatus__c": "ACTIVE"
          },
          {
              "CA10A2__disappearanceTime__c": null,
              "expectedResult": {
                  "runtimeError": null,
                  "conditionText": "extract('CA10A2__statelessDefaultActions__c').asSetOfText('\\n').containsAny(setOfText(['aws:drop', 'aws:forward_to_sfe'])) && extract('CA10A2__statelessFragmentDefaultActions__c').asSetOfText('\\n').containsAny(setOfText(['aws:drop', 'aws:forward_to_sfe']))",
                  "conditionIndex": 499,
                  "status": "COMPLIANT"
              },
              "context": {
                  "snapshotTime": "2026-01-15T10:42:39Z"
              },
              "CA10A2__statelessDefaultActions__c": "aws:forward_to_sfe",
              "CA10A2__statelessFragmentDefaultActions__c": "action\naws:drop",
              "Id": "test6",
              "CA10A2__firewallPolicyStatus__c": "ACTIVE"
          },
          {
              "CA10A2__disappearanceTime__c": null,
              "expectedResult": {
                  "runtimeError": null,
                  "conditionText": "extract('CA10A2__statelessDefaultActions__c').asSetOfText('\\n').containsAny(setOfText(['aws:drop', 'aws:forward_to_sfe'])) && extract('CA10A2__statelessFragmentDefaultActions__c').asSetOfText('\\n').containsAny(setOfText(['aws:drop', 'aws:forward_to_sfe']))",
                  "conditionIndex": 499,
                  "status": "COMPLIANT"
              },
              "context": {
                  "snapshotTime": "2026-01-15T10:42:39Z"
              },
              "CA10A2__statelessDefaultActions__c": "action\naws:drop",
              "CA10A2__statelessFragmentDefaultActions__c": "aws:forward_to_sfe",
              "Id": "test7",
              "CA10A2__firewallPolicyStatus__c": "ACTIVE"
          }
      ]
  - path: /types/CA10A2__CaAwsNetworkFirewallFirewallPolicy__c/object.extracts.yaml
    md5Hash: 7D78149FCF8A2F3ABE66E6CFC4C9C395
    content: "---\nextracts:\n# Values: ACTIVE | DELETING | ERROR. Not nullable. \n\
      \  - name: CA10A2__firewallPolicyStatus__c\n    value:\n      FIELD: \n    \
      \    path: CA10A2__firewallPolicyStatus__c\n        undeterminedIf:\n      \
      \    noAccessDelegate:\n            path: \"CA10A2__firewallPolicyStatus__c\"\
      \n            currentStateMessage: \"Firewall Policy Status cannot be empty.\
      \ Possible permissions issue with networkfirewall:DescribeFirewallPolicy.\"\n\
      # Values: must be one of the defaults aws:pass | aws:drop | aws:forward_to_sfe\
      \ and custom actions\n# Not nullable\n  - name: CA10A2__statelessDefaultActions__c\n\
      \    value:\n      FIELD: \n        path: CA10A2__statelessDefaultActions__c\n\
      \        undeterminedIf:\n          noAccessDelegate:\n            path: \"\
      CA10A2__statelessDefaultActions__c\"\n            currentStateMessage: \"Firewall\
      \ Policy Stateless Default Actions cannot be empty. Possible permissions issue\
      \ with networkfirewall:DescribeFirewallPolicy.\"\n# Values: must be one of the\
      \ defaults aws:pass | aws:drop | aws:forward_to_sfe and custom actions\n# Not\
      \ nullable\n  - name: CA10A2__statelessFragmentDefaultActions__c\n    value:\n\
      \      FIELD: \n        path: CA10A2__statelessFragmentDefaultActions__c\n \
      \       undeterminedIf:\n          noAccessDelegate:\n            path: \"CA10A2__statelessFragmentDefaultActions__c\"\
      \n            currentStateMessage: \"Firewall Policy Stateless Default Actions\
      \ cannot be empty. Possible permissions issue with networkfirewall:DescribeFirewallPolicy.\"\
      \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" : "test1",
    "expectedResult" : {
      "runtimeError" : null,
      "conditionText" : "isDisappeared(CA10A2__disappearanceTime__c)",
      "conditionIndex" : 99,
      "status" : "DISAPPEARED"
    }
  }, {
    "Id" : "test2",
    "expectedResult" : {
      "runtimeError" : null,
      "conditionText" : "CA10A2__firewallPolicyStatus__c.delegatedTo(CA10A2__firewallPolicyStatus__c).isEmpty()",
      "conditionIndex" : 101,
      "status" : "UNDETERMINED"
    }
  }, {
    "Id" : "test3",
    "expectedResult" : {
      "runtimeError" : null,
      "conditionText" : "extract('CA10A2__firewallPolicyStatus__c') != 'ACTIVE'",
      "conditionIndex" : 199,
      "status" : "INAPPLICABLE"
    }
  }, {
    "Id" : "test4",
    "expectedResult" : {
      "runtimeError" : null,
      "conditionText" : "extract('CA10A2__statelessDefaultActions__c').contains('aws:pass')",
      "conditionIndex" : 299,
      "status" : "INCOMPLIANT"
    }
  }, {
    "Id" : "test5",
    "expectedResult" : {
      "runtimeError" : null,
      "conditionText" : "extract('CA10A2__statelessDefaultActions__c').contains('aws:pass')",
      "conditionIndex" : 299,
      "status" : "INCOMPLIANT"
    }
  }, {
    "Id" : "test6",
    "expectedResult" : {
      "runtimeError" : null,
      "conditionText" : "extract('CA10A2__statelessDefaultActions__c').asSetOfText('\\n').containsAny(setOfText(['aws:drop', 'aws:forward_to_sfe'])) && extract('CA10A2__statelessFragmentDefaultActions__c').asSetOfText('\\n').containsAny(setOfText(['aws:drop', 'aws:forward_to_sfe']))",
      "conditionIndex" : 499,
      "status" : "COMPLIANT"
    }
  }, {
    "Id" : "test7",
    "expectedResult" : {
      "runtimeError" : null,
      "conditionText" : "extract('CA10A2__statelessDefaultActions__c').asSetOfText('\\n').containsAny(setOfText(['aws:drop', 'aws:forward_to_sfe'])) && extract('CA10A2__statelessFragmentDefaultActions__c').asSetOfText('\\n').containsAny(setOfText(['aws:drop', 'aws:forward_to_sfe']))",
      "conditionIndex" : 499,
      "status" : "COMPLIANT"
    }
  } ];
  """;

  CREATE TEMP FUNCTION mock_CA10A2__CaAwsNetworkFirewallFirewallPolicy__c()
  RETURNS ARRAY<STRUCT<
      CA10A2__disappearanceTime__c TIMESTAMP,
      CA10A2__firewallPolicyStatus__c STRING,
      CA10A2__statelessDefaultActions__c STRING,
      CA10A2__statelessFragmentDefaultActions__c STRING,
      Id STRING,
      context STRUCT<
          snapshotTime TIMESTAMP
      >
  >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "context" : {
      "snapshotTime" : new Date("2026-01-15T10:42:39Z")
    },
    "CA10A2__disappearanceTime__c" : new Date("2026-01-15T10:42:39Z"),
    "CA10A2__firewallPolicyStatus__c" : "",
    "CA10A2__statelessDefaultActions__c" : "",
    "CA10A2__statelessFragmentDefaultActions__c" : "",
    "Id" : "test1"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-15T10:42:39Z")
    },
    "CA10A2__firewallPolicyStatus__c" : "",
    "CA10A2__statelessDefaultActions__c" : "",
    "CA10A2__statelessFragmentDefaultActions__c" : "",
    "Id" : "test2"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-15T10:42:39Z")
    },
    "CA10A2__firewallPolicyStatus__c" : "ERROR",
    "CA10A2__statelessDefaultActions__c" : "",
    "CA10A2__statelessFragmentDefaultActions__c" : "",
    "Id" : "test3"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-15T10:42:39Z")
    },
    "CA10A2__firewallPolicyStatus__c" : "ACTIVE",
    "CA10A2__statelessDefaultActions__c" : "aws:pass",
    "CA10A2__statelessFragmentDefaultActions__c" : "aws:pass",
    "Id" : "test4"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-15T10:42:39Z")
    },
    "CA10A2__firewallPolicyStatus__c" : "ACTIVE",
    "CA10A2__statelessDefaultActions__c" : "action\naws:pass",
    "CA10A2__statelessFragmentDefaultActions__c" : "action\naws:pass",
    "Id" : "test5"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-15T10:42:39Z")
    },
    "CA10A2__firewallPolicyStatus__c" : "ACTIVE",
    "CA10A2__statelessDefaultActions__c" : "aws:forward_to_sfe",
    "CA10A2__statelessFragmentDefaultActions__c" : "action\naws:drop",
    "Id" : "test6"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-15T10:42:39Z")
    },
    "CA10A2__firewallPolicyStatus__c" : "ACTIVE",
    "CA10A2__statelessDefaultActions__c" : "action\naws:drop",
    "CA10A2__statelessFragmentDefaultActions__c" : "aws:forward_to_sfe",
    "Id" : "test7"
  } ];
  """;

  CREATE TEMP FUNCTION process_CA10A2__CaAwsNetworkFirewallFirewallPolicy__c(
      obj STRUCT<
          CA10A2__disappearanceTime__c TIMESTAMP,
          CA10A2__firewallPolicyStatus__c STRING,
          CA10A2__statelessDefaultActions__c STRING,
          CA10A2__statelessFragmentDefaultActions__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
  AS r"""
  var CollectionLib = new function () {
      this.parse = function(arg, separator, skipEmpty, skipDuplicates, sort, normalize) {
          if (arg == null) return [];
          let parts = arg.split(separator);
          return this.fromArray(parts, skipEmpty, skipDuplicates, sort, normalize);
      };
      this.fromArray = function(arr, skipEmpty, skipDuplicates, sort, normalize) {
          if (arr == null) return [];
          let result = [];
          let seen = new Set();
          arr.forEach(el => {
              let normalized = normalize ? TextLib.normalize(el) : BytesLib.normalize(el);
              if (!skipEmpty || (normalize ? TextLib.isNotEmpty(el) : BytesLib.isNotEmpty(el))) {
                  if (!skipDuplicates || !seen.has(normalized)) {
                      if (skipDuplicates) seen.add(normalized);
                      result.push(normalized);
                  }
              }
          });
          if (sort) result.sort();
          return result;
      };
      this.equal = function(left, right) {
          left = left == null ? [] : left;
          right = right == null ? [] : right;
          if (left.length !== right.length) return false;
          for (let i = 0; i < left.length; i++) {
              if (left[i] !== right[i]) return false;
          }
          return true;
      };
      this.notEqual = function(left, right) {
          return !this.equal(left, right);
      };
      this.size = function(collection) {
          return collection == null ? 0 : collection.length;
      };
      this.startsWith = function(collection, search, normalize) {
          if (collection == null || collection.length === 0) return false;
          let normalizedSearch = normalize ? TextLib.normalize(search) : BytesLib.normalize(search);
          return collection[0] === normalizedSearch;
      };
      this.endsWith = function(collection, search, normalize) {
          if (collection == null || collection.length === 0) return false;
          let normalizedSearch = normalize ? TextLib.normalize(search) : BytesLib.normalize(search);
          return collection[collection.length - 1] === normalizedSearch;
      };
      this.contains = function(collection, search, normalize) {
          if (collection == null || collection.length === 0) return false;
          return collection.includes(normalize ? TextLib.normalize(search) : BytesLib.normalize(search));
      };
      this.containsAll = function(collection, searchArray, normalize) {
          if (collection == null || collection.length === 0 || searchArray == null || searchArray.length === 0) return false;
          return searchArray.every(search => collection.includes(normalize ? TextLib.normalize(search) : BytesLib.normalize(search)));
      };
      this.containsAny = function(collection, searchArray, normalize) {
          if (collection == null || collection.length === 0 || searchArray == null || searchArray.length === 0) return false;
          return searchArray.some(search => collection.includes(normalize ? TextLib.normalize(search) : BytesLib.normalize(search)));
      };
  }();
  var BytesLib = new function () {
      this.normalize = function(arg) {
          return arg == null ? '' : arg;
      };
      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 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 [CA10A2__disappearanceTime__c]: ' + obj.CA10A2__disappearanceTime__c);
      if (obj.CA10A2__disappearanceTime__c != null) {
          return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10A2__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.CA10A2__firewallPolicyStatus__c)) {
              throw new Error("UNDETERMINED condition:101", {cause: {status: 'UNDETERMINED', conditionIndex: 101, conditionText: "CA10A2__firewallPolicyStatus__c.delegatedTo(CA10A2__firewallPolicyStatus__c).isEmpty()", currentStateMessage: "Firewall Policy Status cannot be empty. Possible permissions issue with networkfirewall:DescribeFirewallPolicy.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10A2__firewallPolicyStatus__c;
      }
      function extract3() { if (!this.out) { this.out = fieldChecked4(); } return this.out; };
      references1.push('Firewall Policy Status [obj.CA10A2__firewallPolicyStatus__c]: ' + obj.CA10A2__firewallPolicyStatus__c);
      try {
          if (TextLib.notEqual(extract3.call(extract3), 'ACTIVE')) {
              return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "extract('CA10A2__firewallPolicyStatus__c') != 'ACTIVE'", currentStateMessage: "The Network Firewall Policy is not active.", 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 fieldChecked7() {
          if (TextLib.isEmpty(obj.CA10A2__statelessDefaultActions__c)) {
              throw new Error("UNDETERMINED condition:201", {cause: {status: 'UNDETERMINED', conditionIndex: 201, conditionText: "CA10A2__statelessDefaultActions__c.delegatedTo(CA10A2__statelessDefaultActions__c).isEmpty()", currentStateMessage: "Firewall Policy Stateless Default Actions cannot be empty. Possible permissions issue with networkfirewall:DescribeFirewallPolicy.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10A2__statelessDefaultActions__c;
      }
      function extract6() { if (!this.out) { this.out = fieldChecked7(); } return this.out; };
      references1.push('Stateless Default Actions [obj.CA10A2__statelessDefaultActions__c]: ' + obj.CA10A2__statelessDefaultActions__c);
      try {
          if (TextLib.contains(extract6.call(extract6), 'aws:pass')) {
              return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "extract('CA10A2__statelessDefaultActions__c').contains('aws:pass')", currentStateMessage: "The stateless default action is not set to Pass for full packets.", currentStateReferences: references1.join('\n'), remediation: "Change the stateless default action to 'aws:drop' or 'aws:forward_to_sfe' to ensure unintended traffic is not allowed.", runtimeError: null};
          }
      } catch (err) {
          if (err.cause && err.cause.status) { return err.cause; } else { throw err; }
      }
      // condition[3], conditionIndex:[300..399]
      function fieldChecked10() {
          if (TextLib.isEmpty(obj.CA10A2__statelessFragmentDefaultActions__c)) {
              throw new Error("UNDETERMINED condition:301", {cause: {status: 'UNDETERMINED', conditionIndex: 301, conditionText: "CA10A2__statelessFragmentDefaultActions__c.delegatedTo(CA10A2__statelessFragmentDefaultActions__c).isEmpty()", currentStateMessage: "Firewall Policy Stateless Default Actions cannot be empty. Possible permissions issue with networkfirewall:DescribeFirewallPolicy.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10A2__statelessFragmentDefaultActions__c;
      }
      function extract9() { if (!this.out) { this.out = fieldChecked10(); } return this.out; };
      references1.push('Stateless Fragment Default Actions [obj.CA10A2__statelessFragmentDefaultActions__c]: ' + obj.CA10A2__statelessFragmentDefaultActions__c);
      try {
          if (TextLib.contains(extract9.call(extract9), 'aws:pass')) {
              return {status: 'INCOMPLIANT', conditionIndex: 399, conditionText: "extract('CA10A2__statelessFragmentDefaultActions__c').contains('aws:pass')", currentStateMessage: "The stateless default action is not set to Pass for fragmented packets.", currentStateReferences: references1.join('\n'), remediation: "Change the stateless default action to 'aws:drop' or 'aws:forward_to_sfe' to ensure unintended traffic is not allowed.", runtimeError: null};
          }
      } catch (err) {
          if (err.cause && err.cause.status) { return err.cause; } else { throw err; }
      }
      // condition[4], conditionIndex:[400..499]
      function fieldChecked13() {
          if (TextLib.isEmpty(obj.CA10A2__statelessDefaultActions__c)) {
              throw new Error("UNDETERMINED condition:401", {cause: {status: 'UNDETERMINED', conditionIndex: 401, conditionText: "CA10A2__statelessDefaultActions__c.delegatedTo(CA10A2__statelessDefaultActions__c).isEmpty()", currentStateMessage: "Firewall Policy Stateless Default Actions cannot be empty. Possible permissions issue with networkfirewall:DescribeFirewallPolicy.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10A2__statelessDefaultActions__c;
      }
      function extract12() { if (!this.out) { this.out = fieldChecked13(); } return this.out; };
      function fieldChecked17() {
          if (TextLib.isEmpty(obj.CA10A2__statelessFragmentDefaultActions__c)) {
              throw new Error("UNDETERMINED condition:402", {cause: {status: 'UNDETERMINED', conditionIndex: 402, conditionText: "CA10A2__statelessFragmentDefaultActions__c.delegatedTo(CA10A2__statelessFragmentDefaultActions__c).isEmpty()", currentStateMessage: "Firewall Policy Stateless Default Actions cannot be empty. Possible permissions issue with networkfirewall:DescribeFirewallPolicy.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10A2__statelessFragmentDefaultActions__c;
      }
      function extract16() { if (!this.out) { this.out = fieldChecked17(); } return this.out; };
      try {
          if (CollectionLib.containsAny(CollectionLib.parse(extract12.call(extract12), '\n', true, true, true, true), CollectionLib.fromArray(['aws:drop', 'aws:forward_to_sfe'], true, true, true, true), true) && CollectionLib.containsAny(CollectionLib.parse(extract16.call(extract16), '\n', true, true, true, true), CollectionLib.fromArray(['aws:drop', 'aws:forward_to_sfe'], true, true, true, true), true)) {
              return {status: 'COMPLIANT', conditionIndex: 499, conditionText: "extract('CA10A2__statelessDefaultActions__c').asSetOfText('\\n').containsAny(setOfText(['aws:drop', 'aws:forward_to_sfe'])) && extract('CA10A2__statelessFragmentDefaultActions__c').asSetOfText('\\n').containsAny(setOfText(['aws:drop', 'aws:forward_to_sfe']))", currentStateMessage: "The stateless default action is set to Drop or Forward.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
          }
      } catch (err) {
          if (err.cause && err.cause.status) { return err.cause; } else { throw err; }
      }
      return {status: 'UNDETERMINED', conditionIndex: 500, 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.CA10A2__disappearanceTime__c AS CA10A2__disappearanceTime__c,
          sObject.CA10A2__firewallPolicyStatus__c AS CA10A2__firewallPolicyStatus__c,
          sObject.CA10A2__statelessDefaultActions__c AS CA10A2__statelessDefaultActions__c,
          sObject.CA10A2__statelessFragmentDefaultActions__c AS CA10A2__statelessFragmentDefaultActions__c,
          sObject.Id AS Id,
          process_CA10A2__CaAwsNetworkFirewallFirewallPolicy__c(
              STRUCT(
                  sObject.CA10A2__disappearanceTime__c AS CA10A2__disappearanceTime__c,
                  sObject.CA10A2__firewallPolicyStatus__c AS CA10A2__firewallPolicyStatus__c,
                  sObject.CA10A2__statelessDefaultActions__c AS CA10A2__statelessDefaultActions__c,
                  sObject.CA10A2__statelessFragmentDefaultActions__c AS CA10A2__statelessFragmentDefaultActions__c,
                  sObject.Id AS Id
              ),
              sObject.context.snapshotTime
          ) as result
      FROM UNNEST(mock_CA10A2__CaAwsNetworkFirewallFirewallPolicy__c()) AS sObject
  ) sObject ON sObject.Id = expectedResult.Id;
