fix(alibabacloud): normalize security group policy case (#12049)

Co-authored-by: xianyao.chen <xychen@xianyaochens-MacBook-Pro.local>
Co-authored-by: Hugo P.Brito <hugopbrit@gmail.com>
This commit is contained in:
Xianyao Chen
2026-07-20 20:57:04 +08:00
committed by GitHub
parent dd81793480
commit e035e0ff62
5 changed files with 7 additions and 6 deletions
@@ -0,0 +1 @@
Alibaba Cloud SSH and RDP security group checks no longer produce false negatives when allowed rules use capitalized `Policy="Accept"` values
@@ -26,7 +26,7 @@ class ecs_securitygroup_restrict_rdp_internet(Check):
for ingress_rule in security_group.ingress_rules:
# Check if rule allows traffic (policy == "accept")
if ingress_rule.get("policy", "accept") != "accept":
if str(ingress_rule.get("policy", "accept")).lower() != "accept":
continue
# Check protocol (tcp for RDP)
@@ -26,7 +26,7 @@ class ecs_securitygroup_restrict_ssh_internet(Check):
for ingress_rule in security_group.ingress_rules:
# Check if rule allows traffic (policy == "accept")
if ingress_rule.get("policy", "accept") != "accept":
if str(ingress_rule.get("policy", "accept")).lower() != "accept":
continue
# Check protocol (tcp for SSH)
@@ -37,7 +37,7 @@ class TestEcsSecurityGroupRestrictRdpInternet:
"ip_protocol": "tcp",
"source_cidr_ip": "0.0.0.0/0",
"port_range": "3389/3389",
"policy": "accept",
"policy": "Accept",
}
],
)
@@ -80,7 +80,7 @@ class TestEcsSecurityGroupRestrictRdpInternet:
"ip_protocol": "tcp",
"source_cidr_ip": "10.0.0.0/24",
"port_range": "3389/3389",
"policy": "accept",
"policy": "Accept",
}
],
)
@@ -37,7 +37,7 @@ class TestEcsSecurityGroupRestrictSSHInternet:
"ip_protocol": "tcp",
"source_cidr_ip": "0.0.0.0/0",
"port_range": "22/22",
"policy": "accept",
"policy": "Accept",
}
],
)
@@ -81,7 +81,7 @@ class TestEcsSecurityGroupRestrictSSHInternet:
"ip_protocol": "tcp",
"source_cidr_ip": "10.0.0.0/24",
"port_range": "22/22",
"policy": "accept",
"policy": "Accept",
}
],
)