Skip to main content
Revetment
Install

Blog · · 14 min read

Envoy Gateway WAF deployment patterns: native module vs sidecar

Compare Envoy Gateway WAF deployment patterns: in-process native module, sidecar, WASM, and ext_proc. See how each attaches, fails, and promotes to blocking.

Envoy Gateway WAF deployment patterns come down to where request inspection happens relative to the Envoy worker thread: in-process as a native module, out-of-process via a sidecar proxy, in a WebAssembly runtime, or over an external gRPC service. Choosing among these Envoy Gateway WAF deployment patterns determines your failure domain, your upgrade workflow, and how you contain false positives before they break production traffic.

When engineering teams migrate from ingress-nginx to Envoy Gateway, they leave behind embedded NGINX Lua scripts and embedded ModSecurity builds. They must decide how to attach Layer 7 inspection to the new data plane. That choice is rarely about syntax. It is about how components crash, how memory is allocated, and whether an unavailable inspection engine stops the ingress pipeline or passes raw requests to application backends.

The four Envoy Gateway WAF deployment patterns, and what actually differs

Teams evaluating an inspection layer for Envoy Gateway choose between four distinct architectural patterns:

  1. An in-process native module compiles directly into the Envoy binary or links directly at runtime, running on the Envoy worker thread inside the same memory space. 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.
  2. A sidecar proxy sits inside a secondary container in the same Kubernetes pod or acts as an intermediate hop, receiving traffic forwarded by Envoy over local loopback before passing it downstream.
  3. A WebAssembly (WASM) filter executes inside a sandboxed runtime embedded directly in the Envoy HTTP filter chain.
  4. An external processing (ext_proc) daemon receives request headers and bodies offloaded by Envoy over a local or remote network socket via Envoy's standard ext_proc filter.

The operational difference across these patterns lies in the physical location of the inspection code relative to the Envoy worker thread. That location dictates three operational realities: the failure domain of the process, the upgrade unit for the gateway fleet, and the blast radius of a single regular expression.

We advise teams to decide on the failure mode they can operate before evaluating rule sets. If a platform team cannot tolerate separate network hops or out-of-memory cascades in adjacent containers, out-of-process patterns introduce operational debt immediately. Conversely, if an organization requires inspection code to execute in an isolated userspace sandbox where crashes cannot terminate the main proxy, in-process architectures require rigorous promotion controls to protect uptime.

Deployment pattern Inspection execution location Network hops per request Failure handling model Upgrade unit
Native module (Revetment) Inside Envoy worker thread 0 In-process execution; scoped route promotion and automatic rollback Gateway container image rollout
Sidecar proxy Separate container via loopback 1 (pod loopback) Pod restart on crash; depends on loopback connection status Independent container or shared pod update
WASM filter Embedded VM in worker thread 0 VM trap handling; bypass or terminate stream based on Envoy configuration Dynamic module reload or Envoy config push
ext_proc daemon Separate service via gRPC 1 (local or remote) gRPC stream timeout; configurable fail-open or fail-close policy Independent daemon deployment and gRPC service lifecycle

How a native module attaches through the Gateway API

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. Because Envoy Gateway implements the Gateway API, routing, listeners, and security controls use standardized Kubernetes resource models.

The attachment hierarchy follows standard Kubernetes resource trees:

  1. A cluster operator provisions a GatewayClass to declare the Envoy Gateway controller implementation.
  2. The platform team defines a Gateway resource to open ports and bind TLS certificates.
  3. Application teams deploy standard HTTPRoute resources to expose their backend services through path and header routing rules.
  4. Security engineers declare custom resources that select specific HTTPRoute resources to govern inspection.

As detailed in the Kubernetes WAF policy-as-code guide, policies are Kubernetes CRDs (RevetmentPolicy, RevetmentException) targeting HTTPRoutes through the Gateway API. The WAF configuration lives in version control directly alongside the route specification.

apiVersion: revetment.io/v1alpha1
kind: RevetmentPolicy
metadata:
  name: checkout-protection
  namespace: e-commerce
spec:
  targetRef:
    group: gateway.networking.k8s.io
    kind: HTTPRoute
    name: checkout-route
  mode: Shadow
  ruleset:
    paranoiaLevel: 1
---
apiVersion: revetment.io/v1alpha1
kind: RevetmentException
metadata:
  name: allow-checkout-tracking-cookie
  namespace: e-commerce
spec:
  targetRef:
    group: gateway.networking.k8s.io
    kind: HTTPRoute
    name: checkout-route
  ruleId: 942100
  match:
    parameter: cookie.session_id

Because custom resources extend the Kubernetes API, route definitions and inspection policies are applied together in CI/CD pipelines. This contrasts with sidecar and ext_proc models. In those patterns, the security team manages a secondary deployment or a fleet of sidecar containers. Those auxiliary services require separate Helm values, distinct resource budgets, and synchronization hooks so an updated route path does not orphan its corresponding inspection filter.

Envoy Gateway security architecture: where inspection sits in the request path

Understanding an Envoy Gateway security architecture requires placing each inspection engine within Envoy's connection model. Envoy terminates incoming TCP streams at a listener. The listener hands the stream to the configured filter chain. For web traffic, the core component is the HTTP Connection Manager (HCM).

The HCM routes incoming traffic through an ordered sequence of HTTP filters. As documented in the Envoy HTTP filter architecture reference, filters operate on headers, data frames, and trailers as requests move through the worker thread before reaching the upstream router filter.

Inspection execution differs across the four deployment models:

  • In-process native modules execute inside the Envoy worker thread. When headers or body chunks arrive, Envoy hands the memory buffer directly to the module without serialization. The data plane inspects requests inside your Envoy process and sends no traffic to Revetment. The hosted console is optional.
  • Sidecar proxies treat the adjacent container as an upstream cluster. The HCM parses the HTTP request, serializes it, sends it across the pod loopback interface, and awaits the response before forwarding traffic to the application.
  • WASM filters execute within an isolated WebAssembly VM hosted inside the worker thread. Headers and bodies are copied across the WebAssembly FFI boundary for analysis.
  • ext_proc filters marshal request data into protobuf structures and open a bidirectional gRPC stream to an external server, as specified in the Envoy ext_proc filter reference. The server inspects the payload and instructs Envoy whether to continue, mutate headers, or return an immediate response.

This architectural placement brings up the fail-open versus fail-closed dilemma. When an inspection component becomes unavailable, does incoming traffic pass uninspected, or does the entire ingress pipeline return 500-series status codes? In-process native filters eliminate the network transport entirely, removing socket timeouts and loopback saturations from the equation.

Failure modes by pattern: what breaks and who gets paged

Every operational abstraction fails under load. Platform engineers must understand the specific point of failure for each option.

Sidecar proxy failure modes

Running a WAF as a sidecar container inside the Envoy pod introduces pod lifecycle hazards. If the sidecar container crashes due to an out-of-memory kill triggered by a heavy POST payload, Kubernetes may mark the entire pod unready. Traffic continues to hit other pods, but the dying pod terminates active connections.

Running sidecars doubles the container management overhead per pod. Platform engineers must tune CPU and memory requests for two containers instead of one. If the sidecar container throttles, requests experience latency spikes on local loopback, causing connection backlog starvation in the main Envoy process.

ext_proc failure modes

The ext_proc model turns inspection into an explicit network dependency. If the gRPC backend becomes saturated or crashes, Envoy must rely on its configured failure mode. If configured to fail closed, all inbound ingress traffic halts immediately. If configured to fail open, security protections disappear silently while traffic continues to flow.

Streaming request and response bodies over gRPC introduces serialized buffer overhead. Envoy must hold body chunks in memory while awaiting instructions from the ext_proc service. If the ext_proc daemon stutters under garbage collection or thread contention, Envoy's internal buffers can exhaust worker memory.

WASM filter failure modes

WebAssembly provides sandboxed memory, preventing a crash in the filter from corrupting Envoy worker heap memory. However, WASM runtimes have rigid ABI constraints. Upgrading an Envoy Gateway minor version can break compatibility with compiled WASM modules, forcing engineers to recompile and validate their security plugins against the exact Envoy toolchain.

When a WASM filter panics or exhausts its allocated linear memory, the VM traps. Envoy can handle the trap without crashing, but the active stream is typically terminated with an HTTP 500 error. If a malformed payload repeatedly crashes the WASM runtime, the filter enters a broken state where legitimate traffic on that thread is denied.

Native module failure modes

A native module runs inside the worker process. The gateway and the module are coupled into a unified container image. Upgrading the WAF means rolling the gateway pods, which must be executed through standard Kubernetes rolling updates.

If an unhandled exception or critical panic occurs within a native module, it risks terminating the Envoy worker thread. Memory safety and strict rule compilation are essential. As we explain in our post on Kubernetes WAF failure modes when rules do not load, syntax validation must happen before execution. Bad rules must never be allowed to crash a live worker.

Rule coverage before you commit: 477 of 620 and the named gaps

Many WAF architectures collapse from unparseable signatures. The standard reference for Layer 7 web application defence is the OWASP Core Rule Set. In CRS implementations, rules define regex patterns, variable extractions, and operator chains. Not all engines can execute every rule construct.

Our rule engine is pinned to a concrete standard: 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. Silent rule omission creates an illusion of protection.

Teams should evaluate any Kubernetes native WAF module or sidecar engine by asking three factual questions:

  1. Which explicit rule IDs from the pinned CRS release are verified to compile?
  2. What paranoia level is supported without destabilizing proxy memory?
  3. Where is the public list of rules that fail to compile?

According to the OWASP Core Rule Set v4.30.0 release notes, the project structures detection across four paranoia levels. As outlined in the OWASP CRS documentation, paranoia level 1 is the baseline tier with minimal false positives for typical web applications. Rules in higher paranoia levels introduce aggressive regular expressions, such as strict character class enforcement, which often require extensive tuning to avoid disrupting standard enterprise APIs.

Engineers must accept the structural realities of signature inspection. Revetment matches known signatures. A genuinely novel exploit passes until a rule for it exists and reaches the deployment; no signature WAF can promise otherwise. No signature WAF can promise total detection or zero false positives. Revetment's workflow is built to show the false positives before blocking.

Shadow mode first: seeing what a rule would block

Because false positives represent a direct risk to application availability, safe deployment requires observing how rules interact with real traffic before enabling rejection. Shadow mode records what a rule would have blocked and lets the request through. Blocking is a separate, per-route promotion.

When an incoming HTTP request matches a signature in shadow mode, the engine produces an audit event containing the context: the exact rule ID, the matching HTTPRoute, the parameter or header name, and a redacted excerpt of the payload. The request proceeds downstream to the application untouched. The console groups shadow events by rule, route, parameter and a redacted excerpt. This grouping provides the exact tuple required to write an exception rather than disabling the rule globally.

Data retention depends on your infrastructure model. The hosted console keeps 7 days on Free and 13 months on Pro. Self-hosted retention is yours to set. The console is hosted or self-hosted. Accounts are operator-invited, not self-serve, and there is no free trial; the Free tier is a product tier.

The standard operating procedure for onboarding an Envoy Gateway route is straightforward:

  1. Apply a RevetmentPolicy in Shadow mode to a single route.
  2. Let the policy run across a representative business cycle to capture scheduled jobs and standard user traffic.
  3. Inspect the audit log to identify high-frequency trigger events.
  4. Determine whether the triggers are malicious attempts or legitimate application behavior using unusual parameter encodings.

Capturing these events inside the native module avoids the overhead of forwarding shadow traffic through a loopback sidecar or streaming payloads over an external ext_proc connection.

Promotion and rollback: the part most deployment patterns skip

Most deployment patterns treat WAF activation as a binary choice: either an entire gateway is in detection mode, or the entire gateway is blocking traffic. Switching from detection to blocking across a whole gateway at once leads to unexpected downtime when an unpredicted payload hits an edge service.

In our architecture, blocking is promoted per route in 1%, 10%, then 100% steps, with an automatic rollback threshold. We walk through the operational timeline for this process in our field guide on promoting WAF rules from shadow to blocking in Envoy Gateway and document our real cluster results in the 28-day migration note.

Under this staged model, an operator defines threshold criteria before beginning the promotion:

  • Define the evaluation window during which error and block rates are calculated.
  • Set a concrete rollback ceiling on 4xx and 5xx responses or total blocks. If the threshold is breached during canary rollout, the policy reverts immediately to shadow mode without manual intervention.
  • Scope rule exceptions to prevent wide security gaps. Exceptions are scoped to a rule, a route, and a parameter. They are not a global rule disable.

If an internal API uses XML payloads inside a JSON field on /api/v1/integrations, triggering rule 941100, the engineer writes an exception binding that rule ID only to that specific parameter on that specific route. The remaining routes on the gateway continue to enforce the rule without degradation.

Managed feed rollout across a fleet, with automatic rollback, is planned for Q1 2027 on Pro. Per-route promotion with rollback is available today. This granular control reduces operational risk when platform teams manage shared gateway infrastructure for multiple independent application squads.

What no deployment pattern fixes: scope limits and operating costs

Choosing an in-process native module, a sidecar, or an external filter does not change the fundamental boundaries of a Layer 7 web application firewall. Platform teams often confuse API gateway security layers with comprehensive edge defense networks.

Revetment operates at Layer 7. It does not absorb volumetric DDoS traffic, filter network packets, protect DNS, or act as a scrubbing network; use an edge CDN or DDoS service for that. Volumetric floods require upstream edge filtering before they hit your gateway nodes.

Functional boundaries must be clearly delineated:

  • Revetment does not implement rate limiting, slowloris protection, HTTP/2 rapid-reset budgets, or concurrency limits. These capabilities belong in Envoy's native connection management and rate-limiting filters.
  • Revetment does not sell bot management, device fingerprinting, account-takeover protection, or credential-stuffing protection.
  • Revetment is pre-GA. It runs in the operator's own production, but the site does not claim general availability or scale proof. It currently secures 18 of 18 policied routes, all blocking since 24 October 2026; the live status is documented on the production proof page.
  • Support is best effort from one maintainer, with no SLA on any tier. Security reports follow the response times on /security.
  • SSO (SAML/OIDC) and roles are planned for Q1 2027 on Pro. They are not available today.
  • Revetment does not hold SOC 2, ISO 27001, PCI DSS, HIPAA, or FedRAMP certifications. Enterprise includes evidence packs for a customer's SOC 2 and PCI DSS 6.4.2 audit. Those are evidence packs, not a Revetment certification.

Choosing a pattern: a short decision checklist

When selecting among Envoy Gateway WAF deployment patterns, apply this technical checklist:

  • Evaluate network hop tolerance. If your ingress architecture cannot accept an extra network hop or serialization across local loopback sockets, eliminate ext_proc and sidecar patterns. Choose an in-process native module or an embedded WASM filter.
  • Measure filter maintenance overhead. If your team lacks the continuous integration resources to recompile, test, and validate a custom WASM module against every Envoy Gateway ABI bump, avoid maintaining an in-house WASM pipeline.
  • Check declarative GitOps alignment. If you require WAF rules, shadow modes, and exceptions to be reviewed in the same pull request as your Gateway API HTTPRoute definitions, pick an architecture that exposes its state via Kubernetes CRDs.
  • Determine your failure domain preference. If you prefer to isolate crashes to an external process at the cost of managing a secondary daemon fleet and configuring timeout fallbacks, evaluate ext_proc. If you prefer unified deployments with zero runtime socket hops, select an in-process module backed by staged route promotion.

Revetment is not open source. The Helm chart and the four images are Apache-2.0. The source repository is private. Revetment ships as a Helm chart and container images. Each install guide states its own validation status; describe only the providers whose guide is marked verified.

Pricing is per cluster, never per request, rule, route, or user. The Free, Pro ($99 founding / $149 list per cluster a month), and Enterprise (quoted) tiers are listed on /pricing.

Pick the failure mode you can operate

Your choice among Envoy Gateway WAF deployment patterns dictates your daily operational routine: whether an upgrade involves rolling a single gateway image or coordinating sidecar versions, whether inspection runs on the CPU core already handling the request or over a loopback socket, and whether a false positive forces a midnight cluster rollback or an automated route-level demotion.

Regardless of the pattern you deploy, begin by running in shadow mode on a single route. Inspect the events, identify the parameter patterns, and verify rule compilation before enabling blocking traffic.

Frequently asked questions

Is a sidecar or an ext_proc service required to run a WAF with Envoy Gateway?

No. While sidecar containers and external processing (ext_proc) servers are common integration patterns, an in-process native module executes directly inside the Envoy proxy process. This eliminates the secondary container, loopback network hop, and auxiliary service deployment.

How does a native module attach to an HTTPRoute through the Gateway API?

A native module integrates using Kubernetes Custom Resource Definitions. A custom policy resource (such as RevetmentPolicy) references the target HTTPRoute using standard Gateway API targetRef syntax. The controller watches these resources and configures the in-process filter directly on the corresponding Envoy listener chain.

What happens to traffic if the WAF component fails or is unavailable?

In an out-of-process ext_proc deployment, failure depends on the configured policy: Envoy can either fail open (allowing uninspected traffic to pass) or fail closed (returning 500-series errors to clients). With a native module running in-process, there is no remote service to lose connection to; runtime reliability is managed by strictly validating rules ahead of time and rolling out blocking rules incrementally per route.

How many OWASP CRS rules load, and where are the missing ones listed?

477 of the pinned OWASP CRS v4.30.0 rule ids compile at paranoia level 1. The specific rules that do not load due to unsupported regex features or operators are publicly enumerated on /what-revetment-cannot-stop.

Can I promote blocking on one route without affecting the others?

Yes. By targeting individual HTTPRoute resources with discrete policies, you can run one route in active blocking while leaving all other application routes in shadow mode or entirely uninspected. Promotion occurs per route in many, many, then many steps, with an automatic rollback threshold.

Read the cannot-stop list, then run shadow mode on one HTTPRoute and compare the events against your current WAF before promoting route traffic to blocking.