Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(query): lower properties protocol #6640

Merged
merged 13 commits into from
May 14, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"severity": "MEDIUM",
"category": "Networking and Firewall",
"descriptionText": "Port 22 (SSH) is exposed to the Internet",
"descriptionUrl": "https://docs.microsoft.com/en-us/azure/templates/microsoft.network/2020-07-01/networksecuritygroups?tabs=json#securityrulepropertiesformat-object",
"descriptionUrl": "https://learn.microsoft.com/en-us/azure/templates/microsoft.network/networksecuritygroups?pivots=deployment-language-bicep#securityrulepropertiesformat",
"platform": "AzureResourceManager",
"descriptionID": "97b6233c",
"cloudProvider": "azure",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ CxPolicy[result] {
properties := value.properties.securityRules[x].properties

properties.access == "Allow"
properties.protocol == "Tcp"
lower(properties.protocol) == "tcp"
properties.direction == "Inbound"
arm_lib.contains_port(properties, 22)
arm_lib.source_address_prefix_is_open(properties)
Expand All @@ -38,7 +38,7 @@ CxPolicy[result] {
properties := typeInfo.properties

properties.access == "Allow"
properties.protocol == "Tcp"
lower(properties.protocol) == "tcp"
properties.direction == "Inbound"
arm_lib.contains_port(properties, 22)
arm_lib.source_address_prefix_is_open(properties)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"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": "securitygroup",
"type": "Microsoft.Network/networkSecurityGroups",
"apiVersion": "2020-11-01",
"location": "location1",
"tags": {},
"properties": {},
"resources": [
{
"type": "securityRules",
"apiVersion": "2020-11-01",
"properties": {
"description": "access to SSH",
"protocol": "TCP",
"sourcePortRange": "*",
"destinationPortRanges": [
"22-23"
],
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 100,
"direction": "Inbound"
},
"name": "sr"
}
]
}
],
"outputs": {}
},
"parameters": {}
},
"kind": "template",
"type": "Microsoft.Blueprint/blueprints/artifacts",
"name": "myTemplate"
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,11 @@
"severity": "MEDIUM",
"line": 22,
"fileName": "positive6.json"
},
{
"queryName": "Network Security Group With Unrestricted Access To SSH",
"severity": "MEDIUM",
"line": 22,
"fileName": "positive7.json"
}
]
Loading