Skip to main content

🧠 Azure SQL Database allows ingress from 0.0.0.0/0 (ANY IP) - prod.logic.yaml 🟒

Flags​

Input Type​

TypeAPI NameExtractsExtract FilesLogic Files
πŸ”’πŸ“• Azure SQL ServerCA10__CaAzureSqlServer__c916

Uses​

Test Results πŸŸ’β€‹

Generated at: 2025-04-24T23:45:46.113662248Z Open

ResultIdCondition IndexCondition TextRuntime Error
🟒test1βœ”οΈ 99βœ”οΈ isDisappeared(CA10__disappearanceTime__c)βœ”οΈ null
🟒test2βœ”οΈ 299βœ”οΈ extract('caJsonFrom__firewallRulesJson__c').jsonQueryText('length([? properties.startIpAddress == \'0.0.0.0\' && (properties.endIpAddress == \'0.0.0.0\' || properties.endIpAddress == \'255.255.255.255\')])') > number(0.0)βœ”οΈ null
🟒test3βœ”οΈ 199βœ”οΈ extract('caJsonFrom__firewallRulesJson__c').jsonQueryText('[? name == \'AllowAllWindowsAzureIps\'].name | [0]') == 'AllowAllWindowsAzureIps'βœ”οΈ null
🟒test4βœ”οΈ 299βœ”οΈ extract('caJsonFrom__firewallRulesJson__c').jsonQueryText('length([? properties.startIpAddress == \'0.0.0.0\' && (properties.endIpAddress == \'0.0.0.0\' || properties.endIpAddress == \'255.255.255.255\')])') > number(0.0)βœ”οΈ null
🟒test5βœ”οΈ 400βœ”οΈ otherwiseβœ”οΈ null
🟒test6βœ”οΈ 400βœ”οΈ otherwiseβœ”οΈ null
🟒test7βœ”οΈ 400βœ”οΈ otherwiseβœ”οΈ null
🟒test8βœ”οΈ 400βœ”οΈ otherwiseβœ”οΈ null
🟒test9βœ”οΈ 101βœ”οΈ CA10__firewallRulesJson__c.delegatedTo(CA10__firewallRulesJson__c).isEmpty()βœ”οΈ null

Generation​

FileMD5
Open/ce/ca/azure/sql-database/disable-database-allows-ingress-from-any-ip-rule/policy.yaml7A0A9175654937E55C7DF7A50BDCEFA5
Open/ce/ca/azure/sql-database/disable-database-allows-ingress-from-any-ip-rule/prod.logic.yamlEE5252204BD9144C8C4F2C4CCC2C5440
Open/types/CA10__CaAzureSqlServer__c/object.extracts.yamlE77808BBEDF31D54E009EEA59AC5EF4B
Open/ce/ca/azure/sql-database/disable-database-allows-ingress-from-any-ip-rule/test-data.json6797079708A7644D13B8854DA81CDA70

Generate FULL script​

java -jar repo-manager.jar policies generate FULL /ce/ca/azure/sql-database/disable-database-allows-ingress-from-any-ip-rule/prod.logic.yaml

Generate DEBUG script​

java -jar repo-manager.jar policies generate DEBUG /ce/ca/azure/sql-database/disable-database-allows-ingress-from-any-ip-rule/prod.logic.yaml

Generate CAPTURE_TEST_DATA script​

java -jar repo-manager.jar policies generate CAPTURE_TEST_DATA /ce/ca/azure/sql-database/disable-database-allows-ingress-from-any-ip-rule/prod.logic.yaml

Generate TESTS script​

java -jar repo-manager.jar policies generate TESTS /ce/ca/azure/sql-database/disable-database-allows-ingress-from-any-ip-rule/prod.logic.yaml

Execute tests​

java -jar repo-manager.jar policies test /ce/ca/azure/sql-database/disable-database-allows-ingress-from-any-ip-rule/prod.logic.yaml

Content​

Open File

---
inputType: "CA10__CaAzureSqlServer__c"
testData:
- file: "test-data.json"
importExtracts:
- file: "/types/CA10__CaAzureSqlServer__c/object.extracts.yaml"
conditions:
- status: "INCOMPLIANT"
currentStateMessage: "SQL Database Server Firewall Rules contain AllowAllWindowsAzureIps rule allowing ingress from 0.0.0.0/0 (ANY IP)."
remediationMessage: "Consider removing or disabling the overly permissive rule."
check:
# searches for the rule with the name AllowAllWindowsAzureIps
IS_EQUAL:
left:
JSON_QUERY_TEXT:
arg:
EXTRACT: "caJsonFrom__firewallRulesJson__c"
expression: "[? name == 'AllowAllWindowsAzureIps'].name | [0]"
undeterminedIf:
evaluationError: "The JSON query has failed."
resultTypeMismatch: "The JSON query did not return text type."
right:
TEXT: "AllowAllWindowsAzureIps"
- status: "INCOMPLIANT"
currentStateMessage: "SQL Database Server Firewall Rules contain a rule allowing ingress from 0.0.0.0/0 (ANY IP)."
remediationMessage: "Consider removing or disabling the overly permissive rule."
check:
# number of rules with start and end IPs as 0.0.0.0
GREATER_THAN:
left:
JSON_QUERY_NUMBER:
arg:
EXTRACT: "caJsonFrom__firewallRulesJson__c"
expression: "length([? properties.startIpAddress == '0.0.0.0' && (properties.endIpAddress == '0.0.0.0' || properties.endIpAddress == '255.255.255.255')])"
undeterminedIf:
evaluationError: "The JSON query has failed."
resultTypeMismatch: "The JSON query did not return number type."
right:
NUMBER: 0.0
- status: "COMPLIANT"
currentStateMessage: "SQL Database Server doesn't have any Firewall Rules."
check:
IS_EMPTY:
arg:
EXTRACT: "CA10__firewallRulesJson__c"
otherwise:
status: "COMPLIANT"
currentStateMessage: "SQL Database Server Firewall Rules do not have a rule allowing ingress from 0.0.0.0/0 (ANY IP)."