Website with 'Http20Enabled' Disabled

  • Query id: 70111098-7f85-48f0-b1b4-e4261cf5f61b
  • Query name: Website with 'Http20Enabled' Disabled
  • Platform: AzureResourceManager
  • Severity: Low
  • Category: Networking and Firewall
  • CWE: 757
  • URL: Github

Description

'Microsoft.Web/sites' should have 'Http20Enabled' enabled
Documentation

Code samples

Code samples with security vulnerabilities

Positive test num. 1 - bicep file
resource webSite 'Microsoft.Web/sites@2020-12-01' = {
  name: 'webSite'
  location: 'location1'
  tags: {}
  properties: {
    enabled: true
    httpsOnly: true
  }
}
Positive test num. 2 - json file
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "2.0.0.0",
  "apiProfile": "2019-03-01-hybrid",
  "parameters": {},
  "variables": {},
  "functions": [],
  "resources": [
    {
      "name": "webSite",
      "type": "Microsoft.Web/sites",
      "apiVersion": "2020-12-01",
      "location": "location1",
      "tags": {},
      "properties": {
        "enabled": true,
        "httpsOnly": true
      },
      "resources": []
    }
  ],
  "outputs": {}
}
Positive test num. 3 - bicep file
resource webSite 'Microsoft.Web/sites@2020-12-01' = {
  name: 'webSite'
  location: 'location1'
  tags: {}
  properties: {
    enabled: true
    httpsOnly: true
    siteConfig: {
      http20Enabled: false
    }
  }
}

Positive test num. 4 - json file
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "2.0.0.0",
  "apiProfile": "2019-03-01-hybrid",
  "parameters": {},
  "variables": {},
  "functions": [],
  "resources": [
    {
      "name": "webSite",
      "type": "Microsoft.Web/sites",
      "apiVersion": "2020-12-01",
      "location": "location1",
      "tags": {},
      "properties": {
        "enabled": true,
        "httpsOnly": true,
        "siteConfig": {
          "http20Enabled": false
        }
      },
      "resources": []
    }
  ],
  "outputs": {}
}
Positive test num. 5 - bicep file
resource webSite 'Microsoft.Web/sites@2020-12-01' = {
  name: 'webSite'
  location: 'location1'
  tags: {}
  properties: {
    enabled: true
    httpsOnly: true
    siteConfig: {}
  }
}
Positive test num. 6 - json file
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "2.0.0.0",
  "apiProfile": "2019-03-01-hybrid",
  "parameters": {},
  "variables": {},
  "functions": [],
  "resources": [
    {
      "name": "webSite",
      "type": "Microsoft.Web/sites",
      "apiVersion": "2020-12-01",
      "location": "location1",
      "tags": {},
      "properties": {
        "enabled": true,
        "httpsOnly": true,
        "siteConfig": {}
      },
      "resources": []
    }
  ],
  "outputs": {}
}
Positive test num. 7 - bicep file
resource webSite 'Microsoft.Web/sites@2020-12-01' = {
  name: 'webSite'
  location: 'location1'
  tags: {}
  properties: {
    enabled: true
    httpsOnly: true
  }
}
Positive test num. 8 - json file
{
  "properties": {
    "template": {
      "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
      "contentVersion": "2.0.0.0",
      "apiProfile": "2019-03-01-hybrid",
      "parameters": {},
      "variables": {},
      "functions": [],
      "resources": [
        {
          "name": "webSite",
          "type": "Microsoft.Web/sites",
          "apiVersion": "2020-12-01",
          "location": "location1",
          "tags": {},
          "properties": {
            "enabled": true,
            "httpsOnly": true
          },
          "resources": []
        }
      ],
      "outputs": {}
    },
    "parameters": {}
  },
  "kind": "template",
  "type": "Microsoft.Blueprint/blueprints/artifacts",
  "name": "myTemplate"
}
Positive test num. 9 - bicep file
resource webSite 'Microsoft.Web/sites@2020-12-01' = {
  name: 'webSite'
  location: 'location1'
  tags: {}
  properties: {
    enabled: true
    httpsOnly: true
    siteConfig: {
      http20Enabled: false
    }
  }
}
Positive test num. 10 - json file
{
  "properties": {
    "template": {
      "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
      "contentVersion": "2.0.0.0",
      "apiProfile": "2019-03-01-hybrid",
      "parameters": {},
      "variables": {},
      "functions": [],
      "resources": [
        {
          "name": "webSite",
          "type": "Microsoft.Web/sites",
          "apiVersion": "2020-12-01",
          "location": "location1",
          "tags": {},
          "properties": {
            "enabled": true,
            "httpsOnly": true,
            "siteConfig": {
              "http20Enabled": false
            }
          },
          "resources": []
        }
      ],
      "outputs": {}
    },
    "parameters": {}
  },
  "kind": "template",
  "type": "Microsoft.Blueprint/blueprints/artifacts",
  "name": "myTemplate"
}
Positive test num. 11 - bicep file
resource webSite 'Microsoft.Web/sites@2020-12-01' = {
  name: 'webSite'
  location: 'location1'
  tags: {}
  properties: {
    enabled: true
    httpsOnly: true
    siteConfig: {}
  }
}
Positive test num. 12 - json file
{
  "properties": {
    "template": {
      "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
      "contentVersion": "2.0.0.0",
      "apiProfile": "2019-03-01-hybrid",
      "parameters": {},
      "variables": {},
      "functions": [],
      "resources": [
        {
          "name": "webSite",
          "type": "Microsoft.Web/sites",
          "apiVersion": "2020-12-01",
          "location": "location1",
          "tags": {},
          "properties": {
            "enabled": true,
            "httpsOnly": true,
            "siteConfig": {}
          },
          "resources": []
        }
      ],
      "outputs": {}
    },
    "parameters": {}
  },
  "kind": "template",
  "type": "Microsoft.Blueprint/blueprints/artifacts",
  "name": "myTemplate"
}

Code samples without security vulnerabilities

Negative test num. 1 - bicep file
resource webSite 'Microsoft.Web/sites@2020-12-01' = {
  name: 'webSite'
  location: 'location1'
  tags: {}
  properties: {
    enabled: true
    httpsOnly: true
    siteConfig: {
      http20Enabled: true
    }
  }
}
Negative test num. 2 - json file
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "2.0.0.0",
  "apiProfile": "2019-03-01-hybrid",
  "parameters": {},
  "variables": {},
  "functions": [],
  "resources": [
    {
      "name": "webSite",
      "type": "Microsoft.Web/sites",
      "apiVersion": "2020-12-01",
      "location": "location1",
      "tags": {},
      "properties": {
        "enabled": true,
        "httpsOnly": true,
        "siteConfig": {
          "http20Enabled": true
        }
      },
      "resources": []
    }
  ],
  "outputs": {}
}
Negative test num. 3 - bicep file
resource webSite 'Microsoft.Web/sites@2020-12-01' = {
  name: 'webSite'
  location: 'location1'
  tags: {}
  properties: {
    enabled: true
    httpsOnly: true
    siteConfig: {
      http20Enabled: true
    }
  }
}

Negative test num. 4 - json file
{
  "properties": {
    "template": {
      "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
      "contentVersion": "2.0.0.0",
      "apiProfile": "2019-03-01-hybrid",
      "parameters": {},
      "variables": {},
      "functions": [],
      "resources": [
        {
          "name": "webSite",
          "type": "Microsoft.Web/sites",
          "apiVersion": "2020-12-01",
          "location": "location1",
          "tags": {},
          "properties": {
            "enabled": true,
            "httpsOnly": true,
            "siteConfig": {
              "http20Enabled": true
            }
          },
          "resources": []
        }
      ],
      "outputs": {}
    },
    "parameters": {}
  },
  "kind": "template",
  "type": "Microsoft.Blueprint/blueprints/artifacts",
  "name": "myTemplate"
}