The Envoy Gateway WAF security policy lifecycle, end to end
How the Envoy Gateway WAF security policy lifecycle works: CRD attachment, shadow evidence, staged promotion, scoped exceptions, and the limits to plan around.
An Envoy Gateway WAF security policy lifecycle is the operational path a web application firewall rule follows from initial cluster configuration to live request blocking and eventual retirement. Managing this lifecycle on Kubernetes requires treating security enforcement as a staged progression across five states: unattached, attached in shadow, promoted, excepted, and retired.
When platform teams migrate from ingress-nginx to Envoy Gateway, edge security controls often break because operators lack an evidence trail to prove what rules block before enforcement begins. Deploying rules directly in blocking mode risks service outages for valid client requests. Leaving rules in monitoring mode indefinitely creates an unmonitored log sink that stops no real attacks. Security controls require evidence. Understanding the mechanics of the Envoy Gateway WAF security policy lifecycle ensures that teams enforce protection per route without destabilizing production services.
What a policy lifecycle actually means on Envoy Gateway
The Envoy Gateway WAF security policy lifecycle defines the operational state of every inspection rule running against ingress traffic. The lifecycle tracks routes individually through five discrete phases:
- Unattached: the HTTPRoute serves traffic through Envoy Gateway, but no inspection logic is bound to it.
- Attached in shadow: a policy targets the route, evaluating requests and recording events without rejecting traffic.
- Promoted: rules actively block matching exploit attempts across verified traffic percentages.
- Excepted: specific rules are bypassed for defined routes and parameters where legitimate business logic conflicts with CRS signatures.
- Retired: policies or route attachments are removed, returning the path to an unpolicied state.
The Kubernetes Gateway API establishes the HTTPRoute as the foundational unit of ownership. In the ingress-nginx architecture, annotations mixed routing definitions, upstream timeouts, and WAF flags inside a single manifest. Modern Kubernetes Gateway API security decouples routing from administrative policy. Application teams manage their own HTTPRoute resources within their namespaces, following the Kubernetes Gateway API HTTPRoute specification. Platform engineers attach security policies to those routes by applying separate custom resources.
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. Policy attachment uses two custom resource definitions: RevetmentPolicy and RevetmentException. The RevetmentPolicy targets routes and sets baseline inspection modes. The RevetmentException resource defines parameter exclusions.
Decoupling routing from security introduces an operational failure mode. If a platform engineer writes a RevetmentPolicy that references an HTTPRoute in another namespace without configuring cross-namespace reference grants, the attachment fails silently at the control plane level. Traffic continues flowing directly to upstream pods. No inspection occurs. The status condition tells the truth. Checking the status subresource of the policy manifest is the only reliable way to confirm attachment before assuming inspection is running.
Stage one: attaching a policy to an HTTPRoute
Policy attachment binds inspection signatures to an active route in Envoy Gateway. An operator applies a RevetmentPolicy object that specifies target routes through Gateway API targetRef stanzas.
This manifest binds baseline inspection to an inventory service route:
apiVersion: waf.revetment.io/v1alpha1
kind: RevetmentPolicy
metadata:
name: inventory-service-waf
namespace: logistics
spec:
targetRef:
group: gateway.networking.k8s.io
kind: HTTPRoute
name: inventory-endpoints
defaultAction: Shadow
paranoiaLevel: 1
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. Inspection happens in process. Because inspection runs inside the memory space of Envoy worker threads, request evaluation introduces no external network hops, eliminates serialization penalties, and removes external daemon timeout failures entirely. As documented in the Envoy HTTP filter documentation, proxy processes pass request buffers sequentially through registered filter chains. Native integration ensures inspection occurs at this pipeline level.
The data plane inspects requests inside your Envoy process and sends no traffic to Revetment. The hosted console is optional. The engine evaluates headers, query parameters, cookies, and HTTP request bodies locally against compiled signature trees. Payload data stays local.
To verify that the policy is bound and actively processing requests, inspect the custom resource status block directly:
kubectl get revetmentpolicy inventory-service-waf -n logistics -o jsonpath='{.status.conditions[?(@.type=="Accepted")].status}'
If this command returns anything other than True, inspect the full object description. The controller writes descriptive rejection reasons to the conditions array, indicating syntax issues, nonexistent target routes, or namespace reference restrictions. Do not assume traffic is being monitored until this status condition is confirmed.
Stage two: shadow mode as the evidence-gathering phase
Shadow mode records what a rule would have blocked and lets the request through. Blocking is a separate, per-route promotion. Entering shadow mode allows an operations team to measure how rules interpret live production traffic before any customer experiences a 403 Forbidden response.
When an incoming HTTP request matches a signature in shadow mode, the internal engine records the transaction details: the exact CRS rule ID, the matching string or pattern, the parameter location, and the target route name. The console groups shadow events by rule, route, parameter, and a redacted excerpt. This grouping clarifies review. Engineers evaluate aggregated patterns instead of parsing thousands of raw log lines.
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. Reviewing signature logic against the official OWASP Core Rule Set documentation helps operators understand why specific request encodings or characters trigger anomaly scores.
The hosted console keeps 7 days on Free and 13 months on Pro. Self-hosted retention is yours to set. If traffic exhibits monthly batch runs, a seven-day window will miss edge-case payloads that trigger rules during end-of-month cycles.
A route should exit shadow mode only when the team satisfies three concrete criteria:
- The team can name every rule ID that has fired on the route over the observation window.
- Every firing has been categorized as either an actual malicious attempt or an application-specific false positive.
- All identified false positives have corresponding, narrowly scoped exceptions written and applied to the cluster.
Rules need evidence. Without a defined schedule and explicit route ownership, teams leave routes in shadow mode indefinitely. A route in shadow mode provides zero active mitigation; it merely documents the attacks that reached the backend application.
Stage three: promoting from shadow to blocking without breaking production
Once shadow evidence confirms that benign traffic flows without false positives, the route can advance to active enforcement. Blocking is promoted per route in many, many, then many steps, with an automatic rollback threshold.
Staged promotion isolates edge cases across distinct verification phases:
- The many canary phase exposes signatures to a small live slice of production clients, catching rare payloads, browser quirks, or character encodings absent in staging.
- The many intermediate phase tests operational handling under higher volume, confirming that error budgets, telemetry pipelines, and proxy metrics remain stable before full enforcement.
- The many steady-state phase actively rejects every request that matches compiled CRS signatures and lacks an explicit exception.
Define the automatic rollback threshold as an absolute ratio before promotion begins. Safety requires strict thresholds. If blocked requests exceed the configured error rate threshold within a five-minute window, the data plane drops the route back to shadow mode automatically to protect service availability. This safety net protects uptime if unexpected client payloads hit the gateway after deployment.
We operate under explicit functional limits: per-route promotion with rollback is available today; managed feed rollout across a fleet, with automatic rollback, is planned for Q1 2027 on Pro. Today, platform teams manage this staged promotion independently on each route via custom resource manifests, ensuring precise control over when and how enforcement changes occur. Detailed mechanical procedures for this transition can be found in our guide on promoting WAF rules from shadow to blocking on Envoy Gateway.
apiVersion: waf.revetment.io/v1alpha1
kind: RevetmentPolicy
metadata:
name: inventory-service-waf
namespace: logistics
spec:
targetRef:
group: gateway.networking.k8s.io
kind: HTTPRoute
name: inventory-endpoints
defaultAction: Block
enforcementRatio: 10
rollback:
errorRateThreshold: "0.5%"
window: 5m
fallbackAction: Shadow
Stage four: exceptions that stay scoped
Generic signatures flag legitimate application requests. Handling these collisions cleanly requires rigorous exception management.
Exceptions are scoped to a rule, a route, and a parameter. They are not a global rule disable. Disabling an entire rule cluster-wide because a single endpoint accepts Markdown text leaves every other application route vulnerable to the attack vectors covered by that rule. A global disable creates invisible security gaps that persist across deployments.
A RevetmentException ties an exclusion directly to the matching component of an HTTP interaction:
apiVersion: waf.revetment.io/v1alpha1
kind: RevetmentException
metadata:
name: allow-markdown-descriptions
namespace: logistics
spec:
targetRef:
group: gateway.networking.k8s.io
kind: HTTPRoute
name: inventory-endpoints
ruleId: 941100
scope:
location: BodyParameter
name: item_description
reason: "Inventory descriptions allow sanitized HTML formatting"
owner: "team-catalog@internal.example"
Exceptions take deliberate work. Every exception manifest must include an owner and a clear operational reason. These exceptions should be versioned in Git alongside the application manifests. When updating baseline rule sets, platform engineers review these manifests to verify whether application updates have made the bypass unnecessary. While granular exclusions require managing more Kubernetes objects than a blanket toggle, this precision keeps the remainder of the route protected. For further examples of parameter-level tuning, see our article on Envoy Gateway WAF exception management.
Stage five: retiring a policy and what the lifecycle leaves behind
Retiring a policy is the final phase of the lifecycle. When a service is deprecated, refactored, or moved behind an external private mesh, security configurations must be cleanly unwound from the cluster.
Retirement requires deleting both the RevetmentPolicy and all associated RevetmentException custom resources. If an operator deletes an HTTPRoute without removing the attached policy, the Kubernetes controller plane retains orphaned policy objects. While these orphaned resources do not break Envoy proxy worker threads directly, they produce reconciling warnings in controller logs and clutter audit reports.
Clean teardown follows a strict reverse order:
- Demote the route from blocking back to shadow mode to confirm that route deletion will not mask hidden dependencies.
- Delete all associated
RevetmentExceptionmanifests belonging to the route namespace. - Delete the
RevetmentPolicytargeting the route. - Verify the Envoy filter chain updates by checking the gateway status conditions.
- Delete the target
HTTPRouteresource.
Audit this removal by checking for unreferenced exception objects across namespaces. A simple label selector or namespace sweep confirms that no dead manifests linger in Git repositories or active clusters.
Frequently asked questions
What is the difference between shadow mode and detection-only mode?
In Envoy Gateway WAF operations, shadow mode evaluates incoming traffic against compiled rules, writes audit events for matches, and passes all requests upstream untouched. Detection-only mode in legacy firewalls often logs events globally across all endpoints without per-route controls. Revetment couples shadow mode to individual HTTPRoute targets, providing route-specific telemetry so operators can stage promotions independently.
Can a single rule be disabled across the entire cluster?
Revetment enforces scoped exceptions rather than global toggles. Exceptions are scoped to a rule, a route, and a parameter. They are not a global rule disable. Disabling a signature everywhere to resolve a conflict on a single endpoint removes protection for every other service in the cluster. If an application payload triggers a false positive, write a RevetmentException specifically targeting that route and parameter.
How does the automatic rollback mechanism work during promotion?
When promoting a route through many, many, and many ratios, the operator defines an error rate threshold within the policy manifest. If the percentage of blocked requests exceeds this threshold during the monitoring window, the native data plane automatically falls back to shadow mode. This automated change prevents an unexpected application payload or third-party client update from causing an extended outage.
Where does request payload inspection occur?
The data plane inspects requests inside your Envoy process and sends no traffic to Revetment. The hosted console is optional. 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. Inspection takes place in worker thread memory, ensuring that request bodies and header data remain inside your Kubernetes cluster perimeter.