Skip to main content
security · kubernetes

NetworkPolicies that declare no ingress or egress rules

resource types
1
rule IDs covered
3
severity
low

What does ZopNight detect here?

ZopNight flags an EKS, GKE or AKS NetworkPolicy whose ingress and egress rule lists are both empty. Pods it selects become isolated in each direction named in `policyTypes`, which defaults to Ingress, with no traffic allowed through. That is also the documented default-deny pattern, so the finding asks you to confirm the lockdown is intentional.

Signal and threshold

How ZopNight evaluates NetworkPolicies that declare no ingress or egress rules.
Field Value
Rule IDsRC-1762 · RC-1862 · RC-1962
Categorysecurity
Severitylow
Metricnone — pure configuration read
Threshold0 ingress rules and 0 egress rules
SourceZopNight
Permissions usedlist networkpolicies.networking.k8s.io · list pods

An empty policy is a deny-all policy

A NetworkPolicy lists allowed connections, and everything it selects but does not allow is blocked. According to the network policies page, a pod becomes isolated for ingress once any policy selecting it includes Ingress in policyTypes, and isolated for egress the same way. From then on only connections allowed by some policy’s rules get through, apart from inbound traffic from the pod’s own node. If policyTypes is omitted, Ingress is always set, and Egress only when the policy has egress rules.

A policy with no rules at all therefore cuts selected pods off in whichever direction it names. Sometimes that is exactly the goal: the documentation’s own default-deny example is a policy with an empty podSelector and policyTypes: [Ingress]. Other times it is a stub committed before its rules were written, or a selector broader than intended, and pods lose traffic without an obvious cause.

Listing policies with no rules

Terminal window
kubectl get networkpolicies -A -o json | jq -r '
.items[]
| select(((.spec.ingress // []) | length) == 0 and ((.spec.egress // []) | length) == 0)
| "\(.metadata.namespace)/\(.metadata.name) podSelector=\(.spec.podSelector | tojson) policyTypes=\(.spec.policyTypes // [] | join(","))"'

kubectl describe networkpolicy <name> -n <namespace> shows which pods it selects and in which directions it isolates them.

Rule counts, both zero

ZopNight reads how many ingress rules and how many egress rules each NetworkPolicy declares, and fires only when both counts are available and add up to zero. A policy with a single rule in either direction is out of scope. The check does not evaluate the selector, the namespace’s other policies, or whether the traffic is actually needed.

When an empty policy is harmless

Policies only take effect when the cluster’s network plugin enforces NetworkPolicy; creating one without such a controller has no effect, so an empty policy on a non-enforcing cluster changes nothing today but will start blocking the day enforcement is switched on. Deliberate default-deny policies are the main expected match, as the false-positive line notes.

A low-severity security review item

No saving is attached. The concern runs both ways: an accidental empty policy causes silent outages, while an intentional one deserves a comment in the manifest so reviewers can tell.

Resolving the finding

  1. Read the policy’s podSelector and policyTypes to see what it isolates.
  2. If it is a deliberate default-deny, check that allow policies exist for the traffic the pods need, and annotate the policy with its purpose.
  3. If it is an unfinished stub, add the intended ingress or egress rules.
  4. If it was created by mistake, remove it with kubectl delete networkpolicy <name> -n <namespace>.

See it fire on your bill.

Connect an account read-only. The first findings land in minutes.

472 rule families across 353 resource types on 22 platforms. Every threshold, metric, and IAM action is documented on these pages before you grant anything.

472 rule families documented
353 resource types covered
read-only default access level
Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001· 20–60% off the bill, first month· 4 platforms · 1 console· Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001· 20–60% off the bill, first month· 4 platforms · 1 console·