Skip to content

Commit f7abdf1

Browse files
Merge branch 'master' into AST-116624_11_6.2_PostgreSQL_Database_ensure_that_the_'log_connections'_database_flag_for_cloud_sql_postgresql_instance_is_set_to_on
2 parents 9c67929 + 3d716f2 commit f7abdf1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1536
-72
lines changed

assets/queries/terraform/azure/app_service_ftps_enforce_disabled/query.rego

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,26 @@ package Cx
33
import data.generic.common as common_lib
44
import data.generic.terraform as tf_lib
55

6+
resources := {"azurerm_app_service", "azurerm_linux_web_app", "azurerm_windows_web_app"}
7+
68
CxPolicy[result] {
7-
function := input.document[i].resource.azurerm_app_service[name]
9+
app := input.document[i].resource[resources[m]][name]
810

9-
function.site_config.ftps_state == "AllAllowed"
11+
app.site_config.ftps_state == "AllAllowed"
1012

1113
result := {
1214
"documentId": input.document[i].id,
13-
"resourceType": "azurerm_app_service",
14-
"resourceName": tf_lib.get_resource_name(function, name),
15-
"searchKey": sprintf("azurerm_app_service[%s].site_config.ftps_state", [name]),
15+
"resourceType": resources[m],
16+
"resourceName": tf_lib.get_resource_name(app, name),
17+
"searchKey": sprintf("%s[%s].site_config.ftps_state", [resources[m], name]),
1618
"issueType": "IncorrectValue",
17-
"keyExpectedValue": sprintf("'azurerm_app_service[%s].site_config.ftps_state' should not be set to 'AllAllowed'", [name]),
18-
"keyActualValue": sprintf("'azurerm_app_service[%s].site_config.ftps_state' is set to 'AllAllowed'", [name]),
19-
"searchLine": common_lib.build_search_line(["resource", "azurerm_app_service", name, "site_config", "ftps_state"], []),
19+
"keyExpectedValue": sprintf("'%s[%s].site_config.ftps_state' should not be set to 'AllAllowed'", [resources[m], name]),
20+
"keyActualValue": sprintf("'%s[%s].site_config.ftps_state' is set to 'AllAllowed'", [resources[m], name]),
21+
"searchLine": common_lib.build_search_line(["resource", resources[m], name, "site_config", "ftps_state"], []),
22+
"remediation": json.marshal({
23+
"before": "AllAllowed",
24+
"after": "FtpsOnly"
25+
}),
26+
"remediationType": "replacement",
2027
}
2128
}

assets/queries/terraform/azure/app_service_ftps_enforce_disabled/test/negative1.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ resource "azurerm_app_service" "negative1" {
77
site_config {
88
dotnet_framework_version = "v4.0"
99
scm_type = "LocalGit"
10-
ftps_state = "FtpsOnly"
10+
ftps_state = "FtpsOnly" # Options: AllAllowed, FtpsOnly, Disabled
1111
}
1212
}

assets/queries/terraform/azure/app_service_ftps_enforce_disabled/test/negative2.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ resource "azurerm_app_service" "negative2" {
77
site_config {
88
dotnet_framework_version = "v4.0"
99
scm_type = "LocalGit"
10-
ftps_state = "Disabled"
10+
ftps_state = "Disabled"
1111
}
1212
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
resource "azurerm_linux_web_app" "negative3" {
2+
name = "negative3"
3+
resource_group_name = azurerm_resource_group.example.name
4+
location = azurerm_service_plan.example.location
5+
service_plan_id = azurerm_service_plan.example.id
6+
7+
site_config {
8+
ftps_state = "Disabled" # Options: AllAllowed, FtpsOnly, Disabled
9+
}
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
resource "azurerm_linux_web_app" "negative4" {
2+
name = "negative4"
3+
resource_group_name = azurerm_resource_group.example.name
4+
location = azurerm_service_plan.example.location
5+
service_plan_id = azurerm_service_plan.example.id
6+
7+
site_config {
8+
ftps_state = "FtpsOnly" # Options: AllAllowed, FtpsOnly, Disabled
9+
}
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
resource "azurerm_windows_web_app" "negative5" {
2+
name = "negative5"
3+
resource_group_name = azurerm_resource_group.example.name
4+
location = azurerm_service_plan.example.location
5+
service_plan_id = azurerm_service_plan.example.id
6+
7+
site_config {
8+
ftps_state = "Disabled" # Options: AllAllowed, FtpsOnly, Disabled
9+
}
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
resource "azurerm_windows_web_app" "negative6" {
2+
name = "negative6"
3+
resource_group_name = azurerm_resource_group.example.name
4+
location = azurerm_service_plan.example.location
5+
service_plan_id = azurerm_service_plan.example.id
6+
7+
site_config {
8+
ftps_state = "FtpsOnly" # Options: AllAllowed, FtpsOnly, Disabled
9+
}
10+
}

assets/queries/terraform/azure/app_service_ftps_enforce_disabled/test/positive1.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ resource "azurerm_app_service" "positive1" {
77
site_config {
88
dotnet_framework_version = "v4.0"
99
scm_type = "LocalGit"
10-
ftps_state = "AllAllowed"
10+
ftps_state = "AllAllowed" # Options: AllAllowed, FtpsOnly, Disabled
1111
}
1212
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
resource "azurerm_linux_web_app" "positive2" {
2+
name = "positive2"
3+
resource_group_name = azurerm_resource_group.example.name
4+
location = azurerm_service_plan.example.location
5+
service_plan_id = azurerm_service_plan.example.id
6+
7+
site_config {
8+
ftps_state = "AllAllowed" # Options: AllAllowed, FtpsOnly, Disabled
9+
}
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
resource "azurerm_windows_web_app" "positive3" {
2+
name = "positive3"
3+
location = azurerm_service_plan.example.location
4+
resource_group_name = azurerm_resource_group.example.name
5+
service_plan_id = azurerm_service_plan.example.id
6+
7+
site_config {
8+
ftps_state = "AllAllowed" # Options: AllAllowed, FtpsOnly, Disabled
9+
}
10+
}

0 commit comments

Comments
 (0)