fix(network_azure): handle capitalized protocols in security group rules (#3808)

This commit is contained in:
Pedro Martín
2024-04-18 08:11:29 +02:00
committed by GitHub
parent ab714f0fc7
commit e6d7965453
4 changed files with 4 additions and 4 deletions
@@ -23,7 +23,7 @@ class network_http_internet_access_restricted(Check):
and int(rule.destination_port_range.split("-")[1]) >= 80
)
)
and rule.protocol in ["TCP", "*"]
and rule.protocol in ["TCP", "Tcp", "*"]
and rule.source_address_prefix in ["Internet", "*", "0.0.0.0/0"]
and rule.access == "Allow"
and rule.direction == "Inbound"
@@ -23,7 +23,7 @@ class network_rdp_internet_access_restricted(Check):
and int(rule.destination_port_range.split("-")[1]) >= 3389
)
)
and rule.protocol in ["TCP", "*"]
and rule.protocol in ["TCP", "Tcp", "*"]
and rule.source_address_prefix in ["Internet", "*", "0.0.0.0/0"]
and rule.access == "Allow"
and rule.direction == "Inbound"
@@ -23,7 +23,7 @@ class network_ssh_internet_access_restricted(Check):
and int(rule.destination_port_range.split("-")[1]) >= 22
)
)
and rule.protocol in ["TCP", "*"]
and rule.protocol in ["TCP", "Tcp", "*"]
and rule.source_address_prefix in ["Internet", "*", "0.0.0.0/0"]
and rule.access == "Allow"
and rule.direction == "Inbound"
@@ -15,7 +15,7 @@ class network_udp_internet_access_restricted(Check):
report.location = security_group.location
report.status_extended = f"Security Group {security_group.name} from subscription {subscription} has UDP internet access restricted."
rule_fail_condition = any(
rule.protocol in ["UDP"]
rule.protocol in ["UDP", "Udp"]
and rule.source_address_prefix in ["Internet", "*", "0.0.0.0/0"]
and rule.access == "Allow"
and rule.direction == "Inbound"