Skip to main content
Revetment
Install

Blog · · 11 min read

Kubernetes WAF failure modes: what happens when rules don't load

A field guide to Kubernetes WAF failure modes: rules that never compile, policies that silently miss routes, and shadow data nobody reads.

Kubernetes WAF failure modes usually stay silent because a web application firewall that fails open produces the exact same HTTP 200 response as a clean request. When an ingress filter drops a rule during startup, misses a Gateway API route binding, or executes an overbroad exception, your gateway returns normal upstream traffic while security dashboards stay green. Proxy logs show nothing unusual. Traffic passes uninspected.

Post-mortems after an injection incident often focus on application code or signature freshness. In practice, the primary operational hazard for teams running Envoy Gateway on Kubernetes is load-time detachment. If you migrated away from ingress-nginx, your operational instincts were formed around monolithic controllers where ingress annotations pushed configuration directly into an embedded proxy template. The Kubernetes Gateway API splits that model across distinct resources: Gateways, HTTPRoutes, and extension policies. Bindings decouple from route manifests. That division creates failure states where a security control compiles partially, attaches nowhere, or evaluates traffic in a permanent shadow state that nobody reviews.

We build Revetment, an in-process security engine for Envoy Gateway. Revetment runs as a native module inside the Envoy process. It is not a sidecar, a WASM plugin, an ext_proc server, or a separate proxy. This architecture shapes how we inspect failure: when an engine executes inside the proxy memory space, you cannot afford crash loops, unparsed regexes, or ambiguous policy bindings. This article dissects the failure modes that decouple a WAF from live traffic, how to catch them using Kubernetes primitives, and how to verify route protection before an incident reveals an uninspected path.

The failure you do not see: why WAF problems start at load time

A web application firewall operates across three distinct operational layers. The first layer is rule compilation, where raw text signatures parse into an in-memory execution tree. The second layer is policy attachment, where cluster resources bind those compiled rules to matching HTTPRoutes. The third layer is runtime enforcement, where the engine evaluates matching traffic in shadow mode or blocks matching anomalies.

A breakdown at any one of these layers causes an Envoy Gateway security failure. If rules fail to parse, the engine omits them from memory. If a policy resource targets the wrong label or namespace, the route serves traffic without routing it through inspection. If shadow mode runs without an active triage loop, blocking does not occur. Downstream applications continue receiving requests normally. Clients complete transactions without error. Prometheus metrics report low latencies. The failure mode is the absence of an event.

Auditing an ingress firewall requires verifying the translation pipeline. Pod health checks prove Envoy started. They do not prove that signatures loaded, that routes bound to the engine, or that inspection rules match incoming requests. When an engine fails silently, telemetry looks indistinguishable from a quiet morning.

Failure mode 1: rules that fail to compile

Signature sets like the OWASP Core Rule Set (CRS) rely on complex regular expressions, macro expansions, and variable transformations. In a CRS-based firewall, rule compilation means translating these textual definitions into the internal matcher representation used by the inspection engine. When an engine encounters syntax it cannot translate, it faces a hard choice: crash the proxy process, abort configuration ingestion, or discard the unparseable rule.

Crashing Envoy causes gateway downtime, which platform teams reject immediately. Aborting configuration leaves Envoy running stale state, which silently decouples routing updates from GitOps commits. Discarding the unparseable rule preserves traffic routing, but it creates blind spots. An operator assumes a standard rule set covers the application, yet individual detection patterns did not load into memory.

In our own engine design, we made compilation limits explicit. 477 of the pinned OWASP CRS v4.30.0 rule ids compile at paranoia level 1. The rules that do not load are named on /what-revetment-cannot-stop. Hiding dropped signatures behind a generic success log creates false security. If an engine fails to compile an SQL injection pattern because of unsupported PCRE backreferences or memory limits during regex compilation, your telemetry must record the dropped rule ID before the proxy takes traffic.

Engineers can detect rule compilation failures by checking module status reports during container initialization. A reliable deployment exposes explicit counters for loaded rules, skipped rules, and compilation errors. When compilation metrics drop below expected thresholds after a rule update, your deployment pipeline must halt promotion.

Failure mode 2: broken Gateway API policy attachment

The Kubernetes Gateway API provides a structured mechanism for attaching policies to network traffic. Under the GEP-713 meta-policy standard, custom policy resources use a targetRef block to select Gateways or HTTPRoutes. This model decouples application routing from security controls, allowing platform teams to govern policy while service teams govern routes.

This decoupling introduces attachment failures. Ingress annotations lived inside the same resource as the path definition. In contrast, a target reference relies on API group, kind, name, and namespace alignment across independent manifests. If an engineer updates an HTTPRoute name during a refactor but omits the corresponding policy update, the policy targets a non-existent resource. The binding drops.

Kubernetes accepts orphaned policies without generating an admission error. The policy controller sees no matching target, while the HTTPRoute sees no attached policy. The gateway continues to proxy requests to upstream pods. The route simply executes without WAF inspection.

apiVersion: revetment.io/v1alpha1
kind: RevetmentPolicy
metadata:
  name: checkout-protection
  namespace: ecom
spec:
  targetRef:
    group: gateway.networking.k8s.io
    kind: HTTPRoute
    name: checkout-route
  defaultAction: Shadow

If checkout-route is renamed to checkout-v2, the policy detaches cleanly. No error appears in the application deployment logs. To catch this condition, monitor the status.conditions field of your policy CRDs. Well-behaved controllers write an Accepted condition with status False and a reason of TargetNotFound when a reference target is missing:

status:
  conditions:
  - type: Accepted
    status: "False"
    reason: TargetNotFound
    message: "HTTPRoute ecom/checkout-route does not exist"
    lastTransitionTime: "2026-11-23T08:00:00Z"

A monitoring agent or Prometheus alert checking for non-accepted policy conditions provides an early warning before traffic flows uninspected.

Failure mode 3: cross-namespace reference rejections

Large clusters separate platform infrastructure from product workloads. Envoy Gateway usually runs in an infrastructure namespace like envoy-gateway-system, while services and their HTTPRoutes reside in application namespaces. This separation triggers cross-namespace attachment barriers.

The Gateway API enforces strict boundaries on references across namespaces to prevent privilege escalation. An application team cannot attach an arbitrary policy to a gateway in another namespace unless an explicit ReferenceGrant allows it. Conversely, if a security policy created by cluster administrators in an infrastructure namespace attempts to target an HTTPRoute in an application namespace, Envoy Gateway ignores the policy unless permitted by controller configuration.

When cross-namespace bindings fail, Envoy Gateway logs reference evaluation errors at debug or info levels, but routing continues. Security engineers assume that because a policy resource exists in Git and applies cleanly with kubectl, the rules protect the route. In reality, the controller rejected the attachment at the namespace boundary.

Resolve this failure mode by auditing policy status fields across all namespaces. Scripting verification checks within CI/CD pipelines ensures that every HTTPRoute targeted by a security manifest shows an active policy attachment condition in cluster state.

Failure mode 4: silent sidecar or ext_proc network degradation

Many Kubernetes WAF implementations run as sidecar containers or standalone services reachable via Envoy's external processing (ext_proc) filter. Under this architecture, the proxy intercepts an HTTP request, transmits the payload over localhost or cluster networking to the inspection engine, awaits a decision, and then resumes request forwarding.

This design creates architectural failure modes around IPC and RPC boundaries. The connection between Envoy and the inspection container requires gRPC streams, buffer pools, and timeout budgets. When memory pressure increases or downstream requests surge, the external processing server slows down. To prevent application traffic from stalling, operators configure failure_mode_allow: true inside the Envoy filter configuration.

When the inspection server crashes, encounters an out-of-memory kill, or exceeds its latency deadline, Envoy drops the inspection call and forwards the request directly to the upstream application. If the external process enters a crash loop, the gateway silently turns into an uninspected bypass. Every request succeeds, while zero rules evaluate.

Revetment runs as a native module inside the Envoy process. It is not a sidecar, a WASM plugin, an ext_proc server, or a separate proxy. By removing the network hop between the proxy filter chain and the WAF matcher, native modules eliminate external serialization and RPC timeouts. For architectures that still use external processors, operators must set up Prometheus alerts tracking ext_proc failure counters, gRPC connection resets, and stream timeout rates.

Failure mode 5: exception leakage and rule invalidation

Writing WAF exceptions is an operational necessity. Web applications accept rich JSON documents, markdown, and search strings that trigger false positives against Core Rule Set patterns. However, poorly structured exceptions represent one of the most frequent operational failure modes in production firewalls.

In traditional ModSecurity deployments, an engineer often disables an offending rule globally via SecRuleRemoveById. That choice eliminates the false positive on the broken endpoint, but it disables the rule across every other route on the proxy. A false positive on a search parameter ends up disabling SQL injection inspection on administrative endpoints.

A second common error is overbroad parameter exclusions. If an exception matches an entire query string or request body instead of an isolated JSON key or form field, attackers can append malicious payloads alongside legitimate parameters.

In Revetment, policies are Kubernetes CRDs (RevetmentPolicy, RevetmentException) targeting HTTPRoutes through the Gateway API. Exceptions are scoped to a rule, a route, and a parameter. They are not a global rule disable. Scoping ensures that a false positive on a specific field does not open blind spots across sibling routes or unrelated parameters:

apiVersion: revetment.io/v1alpha1
kind: RevetmentException
metadata:
  name: allow-markdown-payload
  namespace: ecom
spec:
  targetRef:
    group: gateway.networking.k8s.io
    kind: HTTPRoute
    name: product-reviews
  ruleId: 941100
  location: BodyJsonPath
  field: "$.review.comment"

By confining exclusions to a specific path and JSON key, the remaining parameters on product-reviews continue to evaluate against rule 941100. Restrictive exception models stop teams from quietly dismantling protection over months of operational drift.

Failure mode 6: permanent shadow mode drift

Shadow mode records what a rule would have blocked and lets the request through. Blocking is a separate, per-route promotion. Teams routinely deploy a WAF in shadow mode to observe false positive rates, evaluate baseline traffic, and tune exceptions. The failure mode is leaving it there indefinitely.

When an engine remains in shadow mode without active human or automated triage, it provides no defensive value. Upstream pods receive malicious payloads alongside normal traffic. Security teams see alerts in logging systems, but without a path to blocking, the alerts become background noise. Engineers begin to ignore alert notifications, assuming that someone else is monitoring the stream.

Moving from shadow mode to blocking requires a structured, gradual promotion process. Turning on blocking for many traffic immediately creates a wide blast radius. Production teams avoid that risk.

Blocking is promoted per route in many, many, then many steps, with an automatic rollback threshold. During fractional promotion, the module evaluates the entire request set, but blocks only a controlled fraction of matching requests while continuing to shadow the rest. If an anomalous surge in 403 responses trips the rollback threshold, the route returns to shadow mode automatically, preserving availability while engineers inspect logs.

The console groups shadow events by rule, route, parameter and a redacted excerpt. The console is hosted or self-hosted. Accounts are operator-invited, not self-serve. Surfacing exact parameter matches and rule IDs allows platform engineers to identify whether an event was a real attack or a false positive before proceeding to higher blocking tiers.

Verifying your WAF pipeline before deployment

To avoid silent WAF failure modes, integrate structural validation into your delivery pipelines. Do not rely solely on end-to-end integration tests that send live attacks against production ingress pods. Run deterministic checks across your Kubernetes manifests:

  • Verify that every HTTPRoute manifest has a corresponding policy object referencing its exact name and namespace.
  • Query the Kubernetes status subresource on all policy objects to ensure controllers report an Accepted state.
  • Ensure rule compilation counters match expected values during startup by scraping module telemetry immediately after pod initialization.
  • Validate that exceptions contain explicit target paths and fields instead of open wildcards.
  • Review routes operating in shadow mode on a weekly schedule to promote clean paths or add scoped exceptions.

Testing synthetic payloads against a local test cluster provides immediate confirmation that Envoy's filter chain executes the security engine. Run an automated curl command sending a benign test signature (such as a simulated cross-site scripting fragment in a query parameter) to an endpoint configured for shadow mode. Check that your logging pipeline records a detection event containing the expected rule ID and parameter key.

Frequently asked questions

What happens when a WAF fails open in Kubernetes?

When a WAF fails open, it bypasses rule evaluation and allows incoming HTTP requests to pass directly to upstream service pods. The gateway returns normal status codes like HTTP 200, and downstream clients experience no disruption. Unless specific error metrics or compilation telemetry are monitored, platform teams remain unaware that inspection has ceased.

Why does Envoy Gateway decouple policy attachment from route definitions?

The Gateway API uses separate policy resources to support multi-tenant operational boundaries. Infrastructure engineers manage Gateways and baseline security policies, while application teams manage HTTPRoutes and service configurations. Decoupling allows permissions to be segmented across RBAC boundaries, but it requires operators to monitor target references to prevent accidental detachment.

How does Revetment integrate with Envoy Gateway?

Revetment runs as a native module inside the Envoy process. It is not a sidecar, a WASM plugin, an ext_proc server, or a separate proxy. Revetment attaches to Envoy Gateway through the Kubernetes Gateway API. It is not an ingress controller and does not run on NGINX, Traefik, HAProxy, or Istio. It uses RevetmentPolicy and RevetmentException custom resources to manage route-level inspection directly within the data plane.

Can a WAF compile every OWASP Core Rule Set pattern?

No. Different regex engines and module implementations support different subsets of ModSecurity syntax and PCRE features. 477 of the pinned OWASP CRS v4.30.0 rule ids compile at paranoia level 1. The rules that do not load are named on /what-revetment-cannot-stop. Any engine that cannot compile a rule must report the omitted identifier explicitly so security engineers can evaluate remaining blind spots.

How should platform teams promote routes from shadow mode to blocking?

Teams should avoid abrupt binary toggles across all traffic. Blocking is promoted per route in many, many, then many steps, with an automatic rollback threshold. Staged fractional rollout limits blast radiuses, giving operators time to identify false positives and configure scoped exceptions before full enforcement.

Does Revetment send request traffic outside the Kubernetes cluster?

The data plane inspects requests inside your Envoy process and sends no traffic to Revetment. The hosted console is optional. The engine runs locally within the proxy memory space, keeping application payloads and inspection processing entirely inside your cluster perimeter.

If you run Envoy Gateway and need to verify your inspection pipeline, inspect your policy conditions in Kubernetes today. You can examine our production setup and route statuses at /proof or install the Apache-2.0 Helm chart from registry.revetment.io.