---
policy: /ce/ca/azure/application-gateway/gateway-ssl-protocol-version
logic: /ce/ca/azure/application-gateway/gateway-ssl-protocol-version/prod.logic.yaml
executionTime: 2025-12-17T01:31:02.152020778Z
generationMs: 46
executionMs: 597
rows:
  - id: '001'
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 299
      actual: 299
    conditionText:
      expected: extract('CA10__sslPolicyMinProtocolVersion__c') == 'TLSv1_0' || extract('CA10__sslPolicyMinProtocolVersion__c')
        == 'TLSv1_1'
      actual: extract('CA10__sslPolicyMinProtocolVersion__c') == 'TLSv1_0' || extract('CA10__sslPolicyMinProtocolVersion__c')
        == 'TLSv1_1'
    runtimeError: {}
  - id: '002'
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 300
      actual: 300
    conditionText:
      expected: otherwise
      actual: otherwise
    runtimeError: {}
  - id: '003'
    match: true
    status:
      expected: UNDETERMINED
      actual: UNDETERMINED
    conditionIndex:
      expected: 199
      actual: 199
    conditionText:
      expected: extract('CA10__sslPolicyMinProtocolVersion__c').isEmpty()
      actual: extract('CA10__sslPolicyMinProtocolVersion__c').isEmpty()
    runtimeError: {}
usedFiles:
  - path: /ce/ca/azure/application-gateway/gateway-ssl-protocol-version/policy.yaml
    md5Hash: CABD1D64599B951CE4DE7A5E88FEA0FE
    content: |
      ---
      names:
        full: "Azure Application Gateway Min SSL protocol version is not TLSv1_2"
        contextual: "Application Gateway Min SSL protocol version is not TLSv1_2"
      description: "The TLS (Transport Layer Security) protocol secures the transmission of data over the\
        \ internet using standard encryption technology. Application gateways use TLS 1.2 for the\
        \ Min protocol version by default and allow for the use of TLS versions 1.0, 1.1, and\
        \ 1.3. NIST strongly suggests the use of TLS 1.2 and recommends the adoption of TLS 1.3."
      type: COMPLIANCE_POLICY
      categories:
        - SECURITY
      frameworkMappings:
        - "/frameworks/cis-azure-v5.0.0/07/12"
        - "/frameworks/cloudaware/resource-security/data-encryption"
  - path: /ce/ca/azure/application-gateway/gateway-ssl-protocol-version/prod.logic.yaml
    md5Hash: A70E6A3849A25588935DABC895F11386
    content: "---\ninputType: \"CA10__CaAzureApplicationGateway__c\"\ntestData:\n\
      \  - file: \"test-data.json\"\nimportExtracts:\n  - file: /types/CA10__CaAzureApplicationGateway__c/object.extracts.yaml\n\
      conditions:\n  - status: \"UNDETERMINED\"\n    currentStateMessage: \"The Application\
      \ Gateway SSL protocol version is undefined (empty value).\"\n    check:\n \
      \     IS_EMPTY:\n        arg:\n          EXTRACT: \"CA10__sslPolicyMinProtocolVersion__c\"\
      \n  - status: \"INCOMPLIANT\"\n    currentStateMessage: \"The Application Gateway\
      \ SSL protocol version is outdated.\"\n    remediationMessage: \"It is highly\
      \ recommended to use TLS 1.2 or higher.\"\n    check:\n      OR:\n        args:\n\
      \          - IS_EQUAL:\n              left:\n                EXTRACT: \"CA10__sslPolicyMinProtocolVersion__c\"\
      \n              right:\n                TEXT: \"TLSv1_0\"\n          - IS_EQUAL:\n\
      \              left:\n                EXTRACT: \"CA10__sslPolicyMinProtocolVersion__c\"\
      \n              right:\n                TEXT: \"TLSv1_1\"\notherwise:\n  status:\
      \ \"COMPLIANT\"\n  currentStateMessage: \"Azure Application Gateway use the\
      \ current SSL protocol version.\" \n"
  - path: /ce/ca/azure/application-gateway/gateway-ssl-protocol-version/test-data.json
    md5Hash: BB9A8B44EB0D654E9E0C5D6283B9B153
    content: |
      [
        {
          "expectedResult": {
            "status": "INCOMPLIANT",
            "conditionIndex": "299",
            "conditionText": "extract('CA10__sslPolicyMinProtocolVersion__c') == 'TLSv1_0' || extract('CA10__sslPolicyMinProtocolVersion__c') == 'TLSv1_1'",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2025-11-10T11:11:03Z" },
          "CA10__disappearanceTime__c": null,
          "CA10__sslPolicyMinProtocolVersion__c": "TLSv1_0",
          "Id": "001"
        },
        {
          "expectedResult": {
            "status": "COMPLIANT",
            "conditionIndex": "300",
            "conditionText": "otherwise",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2025-11-10T11:11:03Z" },
          "CA10__disappearanceTime__c": null,
          "CA10__sslPolicyMinProtocolVersion__c": "TLSv1_2",
          "Id": "002"
        },
        {
          "expectedResult": {
            "status": "UNDETERMINED",
            "conditionIndex": "199",
            "conditionText": "extract('CA10__sslPolicyMinProtocolVersion__c').isEmpty()",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2025-11-10T11:11:03Z" },
          "CA10__disappearanceTime__c": null,
          "CA10__sslPolicyMinProtocolVersion__c": null,
          "Id": "003"
        }
      ]
  - path: /types/CA10__CaAzureApplicationGateway__c/object.extracts.yaml
    md5Hash: 0D83E678F320459334C801870D84974C
    content: "---\nextracts:\n# Checkbox.\n  - name: \"CA10__wafEnabled__c\"\n   \
      \ value: \n      FIELD:\n        path: \"CA10__wafEnabled__c\"\n# Text. Nullable\n\
      \  - name: \"CA10__sslPolicyMinProtocolVersion__c\"\n    value: \n      FIELD:\n\
      \        path: \"CA10__sslPolicyMinProtocolVersion__c\"\n# Checkbox.\n  - name:\
      \ \"CA10__enableHttp2__c\"\n    value: \n      FIELD:\n        path: \"CA10__enableHttp2__c\"\
      \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" : "INCOMPLIANT",
      "conditionIndex" : "299",
      "conditionText" : "extract('CA10__sslPolicyMinProtocolVersion__c') == 'TLSv1_0' || extract('CA10__sslPolicyMinProtocolVersion__c') == 'TLSv1_1'",
      "runtimeError" : null
    }
  }, {
    "Id" : "002",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : "300",
      "conditionText" : "otherwise",
      "runtimeError" : null
    }
  }, {
    "Id" : "003",
    "expectedResult" : {
      "status" : "UNDETERMINED",
      "conditionIndex" : "199",
      "conditionText" : "extract('CA10__sslPolicyMinProtocolVersion__c').isEmpty()",
      "runtimeError" : null
    }
  } ];
  """;

  CREATE TEMP FUNCTION mock_CA10__CaAzureApplicationGateway__c()
  RETURNS ARRAY<STRUCT<
      CA10__disappearanceTime__c TIMESTAMP,
      CA10__sslPolicyMinProtocolVersion__c STRING,
      Id STRING,
      context STRUCT<
          snapshotTime TIMESTAMP
      >
  >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "context" : {
      "snapshotTime" : new Date("2025-11-10T11:11:03Z")
    },
    "CA10__sslPolicyMinProtocolVersion__c" : "TLSv1_0",
    "Id" : "001"
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-11-10T11:11:03Z")
    },
    "CA10__sslPolicyMinProtocolVersion__c" : "TLSv1_2",
    "Id" : "002"
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-11-10T11:11:03Z")
    },
    "CA10__sslPolicyMinProtocolVersion__c" : null,
    "Id" : "003"
  } ];
  """;

  CREATE TEMP FUNCTION process_CA10__CaAzureApplicationGateway__c(
      obj STRUCT<
          CA10__disappearanceTime__c TIMESTAMP,
          CA10__sslPolicyMinProtocolVersion__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 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 Azure [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__sslPolicyMinProtocolVersion__c; } return this.out; };
      references1.push('SSL Policy Min Protocol Version [obj.CA10__sslPolicyMinProtocolVersion__c]: ' + obj.CA10__sslPolicyMinProtocolVersion__c);
      if (TextLib.isEmpty(extract3.call(extract3))) {
          return {status: 'UNDETERMINED', conditionIndex: 199, conditionText: "extract('CA10__sslPolicyMinProtocolVersion__c').isEmpty()", currentStateMessage: "The Application Gateway SSL protocol version is undefined (empty value).", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[2], conditionIndex:[200..299]
      function extract6() { if (!this.out) { this.out = obj.CA10__sslPolicyMinProtocolVersion__c; } return this.out; };
      if (TextLib.equal(extract6.call(extract6), 'TLSv1_0') || TextLib.equal(extract6.call(extract6), 'TLSv1_1')) {
          return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "extract('CA10__sslPolicyMinProtocolVersion__c') == 'TLSv1_0' || extract('CA10__sslPolicyMinProtocolVersion__c') == 'TLSv1_1'", currentStateMessage: "The Application Gateway SSL protocol version is outdated.", currentStateReferences: references1.join('\n'), remediation: "It is highly recommended to use TLS 1.2 or higher.", runtimeError: null};
      }
      return {status: 'COMPLIANT', conditionIndex: 300, conditionText: "otherwise", currentStateMessage: "Azure Application Gateway use the current SSL protocol version.", 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__sslPolicyMinProtocolVersion__c AS CA10__sslPolicyMinProtocolVersion__c,
          sObject.Id AS Id,
          process_CA10__CaAzureApplicationGateway__c(
              STRUCT(
                  sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
                  sObject.CA10__sslPolicyMinProtocolVersion__c AS CA10__sslPolicyMinProtocolVersion__c,
                  sObject.Id AS Id
              ),
              sObject.context.snapshotTime
          ) as result
      FROM UNNEST(mock_CA10__CaAzureApplicationGateway__c()) AS sObject
  ) sObject ON sObject.Id = expectedResult.Id;
