fix(ec2): reject invalid IPv4 managed prefix list entries (#6566)

Reject malformed and non-network IPv4 CIDRs before customer-managed prefix list creation or modification. Preserve IPv6 spelling and existing missing/family validation.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
This commit is contained in:
Andre Kurait authored and GitHub committed 2026-10-25 21:53:50 -04:00
1 parent 2a5f734777
commit bffffedb88
3 files changed
+163

No files matched your search

@@ -2058,6 +2058,11 @@ public class Ec2Service implements ContainerTeardown, ResourceProvider, Resettab
throw new AwsException("InvalidParameterValue",
"The CIDR '" + entry.getCidr() + "' does not match the address family " + addressFamily + ".", 400);
}
if (!ipv6 && !CidrCanonicalizer.isCanonical(entry.getCidr())) {
throw new AwsException("InvalidParameterValue",
"The specified CIDR (" + entry.getCidr() + ") is not valid. "
+ "For example, specify a CIDR in the following form: 10.0.0.0/16.", 400);
}
}
private String key(String region, String id) {