Skip to content

Commit

Permalink
update(query): Updated Unrestricted SQL Server Access query Checkmar…
Browse files Browse the repository at this point in the history
…x#3463

Signed-off-by: João Reigota <[email protected]>
  • Loading branch information
joaoReigota1 authored May 28, 2021
1 parent 91d11cb commit 34b710e
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,6 @@ import data.generic.common as commonLib

modules := {"azure.azcollection.azure_rm_sqlfirewallrule", "azure_rm_sqlfirewallrule"}

CxPolicy[result] {
task := ansLib.tasks[id][t]
rule := task[modules[m]]
ansLib.checkState(rule)

rule.start_ip_address == "0.0.0.0"
rule.end_ip_address == "0.0.0.0"

result := {
"documentId": id,
"searchKey": sprintf("name={{%s}}.{{%s}}", [task.name, modules[m]]),
"issueType": "IncorrectValue",
"keyExpectedValue": "azure_rm_sqlfirewallrule.start_ip_address is different from '0.0.0.0' and azure_rm_sqlfirewallrule.end_ip_address is different from '0.0.0.0'",
"keyActualValue": "azure_rm_sqlfirewallrule.start_ip_address is '0.0.0.0' and azure_rm_sqlfirewallrule.end_ip_address is '0.0.0.0'",
}
}

CxPolicy[result] {
task := ansLib.tasks[id][t]
rule := task[modules[m]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
server_name: firewallrulecrudtest-6285
name: firewallrulecrudtest-5370
start_ip_address: 0.0.0.0
end_ip_address: 0.0.0.0
end_ip_address: 172.28.11.138
- name: Create (or update) Firewall Rule2
azure_rm_sqlfirewallrule:
resource_group: myResourceGroup2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,6 @@ package Cx

import data.generic.common as lib

CxPolicy[result] {
resource := input.document[i].resource.azurerm_sql_firewall_rule[name]
resource.start_ip_address == "0.0.0.0"
resource.end_ip_address == "0.0.0.0"

result := {
"documentId": input.document[i].id,
"searchKey": sprintf("azurerm_sql_firewall_rule[%s].start_ip_address", [name]),
"issueType": "IncorrectValue",
"keyExpectedValue": sprintf("'azurerm_sql_firewall_rule[%s].start_ip_address' is different from '0.0.0.0'", [name]),
"keyActualValue": sprintf("'azurerm_sql_firewall_rule[%s].start_ip_address' is equal to '0.0.0.0'", [name]),
}
}

CxPolicy[result] {
resource := input.document[i].resource.azurerm_sql_firewall_rule[name]
startIP_value := lib.calc_IP_value(resource.start_ip_address)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ resource "azurerm_sql_firewall_rule" "positive3" {
resource_group_name = azurerm_resource_group.example.name
server_name = azurerm_sql_server.example.name
start_ip_address = "0.0.0.0"
end_ip_address = "0.0.0.0"
end_ip_address = "10.0.27.62"
}

resource "azurerm_sql_firewall_rule" "positive4" {
Expand Down

0 comments on commit 34b710e

Please sign in to comment.