terraform.azure.security.appservice.appservice-authentication-enabled.appservice-authentication-enabled
semgrep
Author
unknown
Download Count*
License
Enabling authentication ensures that all communications in the application are authenticated. The auth_settings
block needs to be filled out with the appropriate auth backend settings
Run Locally
Run in CI
Defintion
rules:
- id: appservice-authentication-enabled
message: Enabling authentication ensures that all communications in the
application are authenticated. The `auth_settings` block needs to be
filled out with the appropriate auth backend settings
patterns:
- pattern: resource
- pattern-not-inside: |
resource "azurerm_app_service" "..." {
...
auth_settings {
...
enabled = true
...
}
...
}
- pattern-either:
- pattern-inside: |
resource "azurerm_app_service" "..." {
...
}
- pattern-inside: |
resource "azurerm_app_service" "..." {
...
auth_settings {
...
enabled = false
...
}
...
}
metadata:
cwe:
- "CWE-287: Improper Authentication"
category: security
technology:
- terraform
- azure
references:
- https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/app_service#auth_settings
owasp:
- A02:2017 - Broken Authentication
- A07:2021 - Identification and Authentication Failures
cwe2022-top25: true
cwe2021-top25: true
subcategory:
- vuln
likelihood: MEDIUM
impact: MEDIUM
confidence: MEDIUM
license: Commons Clause License Condition v1.0[LGPL-2.1-only]
vulnerability_class:
- Improper Authentication
languages:
- hcl
severity: ERROR
Examples
appservice-authentication-enabled.tf
resource "azurerm_app_service" "good_example" {
name = "example-app-service"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
app_service_plan_id = azurerm_app_service_plan.example.id
auth_settings {
enabled = true
}
}
# ruleid: appservice-authentication-enabled
resource "azurerm_app_service" "bad_example" {
name = "example-app-service"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
app_service_plan_id = azurerm_app_service_plan.example.id
}
# ruleid: appservice-authentication-enabled
resource "azurerm_app_service" "bad_example" {
name = "example-app-service"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
app_service_plan_id = azurerm_app_service_plan.example.id
auth_settings {
enabled = false
}
}
Short Link: https://sg.run/JxYw