Panther medium experimental python

AWS Security Group Restricts Access To CDE

This policy validates that are considered part of the PCI CDE do not allow any access from public IP space.

View Source

Detection Logic

from ipaddress import ip_network


def policy(resource):

    for permission in resource["IpPermissions"] or []:
        # Check if any traffic is allowed from public IP space
        for ip_range in permission["IpRanges"] or []:
            if ip_range["CidrIp"] == "0.0.0.0/0" or not ip_network(ip_range["CidrIp"]).is_private:
                return False
        for ip_range in permission["Ipv6Ranges"] or []:
            if ip_range["CidrIpv6"] == "::/0" or not ip_network(ip_range["CidrIpv6"]).is_private:
                return False

    return True

Field Validations

Loading…

Comments (0)

Loading comments...