Envoy Gateway WAF exception management: scoping rules to a route and parameter
Envoy Gateway WAF exception management with Revetment scopes exceptions to one rule, route and parameter, stopping false positives without global disables.
Effective Envoy Gateway WAF exception management stops false positives on a specific parameter without disabling protective rules across your entire cluster. By defining scoped WAF rule exceptions at the route and parameter level, platform teams keep Core Rule Set protections active everywhere else while legitimate traffic passes without interruption. 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.
When an ingress rule flags a legitimate user action, platform engineers face an immediate trade-off. Disabling the rule globally resolves the immediate user issue but removes the signature cluster-wide. Envoy Gateway WAF exception management requires a narrower mechanism: target the exact rule ID, the specific HTTPRoute, and the offending parameter, leaving the rest of the ingress policy intact.
The false positive you cannot fix by turning the rule off
Consider a standard operational scenario on Kubernetes. An internal administrative portal allows support staff to paste raw SQL diagnostic snippets, or an e-commerce checkout accepts customer notes containing apostrophes and hyphens. A rule from the OWASP Core Rule Set (CRS), such as rule 942100 for SQL injection detection, matches the input string and triggers a block. The request fails, returning a 403 Forbidden to the client.
The immediate impulse during an on-call escalation is to turn rule 942100 off. In older ingress setups, engineers accomplished this by setting global configuration flags or dropping the rule ID into an exclusion list applied across the entire proxy. That global disable is a poor trade. Rule 942100 inspects inputs for SQL injection across every route exposed by the proxy. Turning it off everywhere because one parameter on one endpoint sends structured text leaves every other API route and public form exposed to standard injection patterns.
Exceptions are scoped to a rule, a route, and a parameter. They are not a global rule disable. Scoped WAF rule exceptions allow the gateway to ignore rule 942100 solely when evaluating the specific parameter on that defined route. If the same pattern appears in the query string of a payment endpoint or the user-agent header of an authentication route, the rule evaluates the payload and blocks the request as intended.
The platform engineer's decision is structural: what is the narrowest possible scope that clears the false positive while preserving security coverage across the perimeter? Broad exclusions create hidden blind spots that accumulate over time. Exceptions do not add detection, they only subtract it in a defined place. When you grant an exception, you accept that the application layer behind that parameter must handle sanitization, input validation, and parameterization on its own.
How a RevetmentException attaches to an HTTPRoute
To implement Envoy Gateway WAF exception management cleanly in GitOps workflows, policies must exist as native Kubernetes resources. Revetment splits configuration across two Custom Resource Definitions (CRDs): RevetmentPolicy and RevetmentException. Both resources target standard HTTPRoute objects defined under the Kubernetes Gateway API specification.
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. Because the engine runs directly inside the proxy process, request inspection happens in memory on the worker thread handling the stream. The architectural overview of Envoy proxy security architecture shows how in-process filter chains evaluate request metadata and body buffers before traffic reaches an upstream cluster. The RevetmentException CRD instructs the engine to bypass evaluation for a named rule against specific fields within those buffers.
The attachment mechanism follows a three-step relationship:
- The platform team defines a standard Gateway API
HTTPRoutethat directs traffic to an upstream KubernetesService. - A
RevetmentPolicytargets theHTTPRouteusing atargetRefblock, attaching the WAF engine and declaring whether the route operates in shadow or blocking state. - One or more
RevetmentExceptionresources target the sameHTTPRoute, declaring exclusions for specific rule IDs and parameter locations.
Consider the structure of a concrete RevetmentException object:
apiVersion: revetment.io/v1alpha1
kind: RevetmentException
metadata:
name: billing-notes-sql-bypass
namespace: apps
spec:
targetRef:
group: gateway.networking.k8s.io
kind: HTTPRoute
name: billing-api
ruleId: "942100"
location: BodyParameter
parameterName: "customer_notes"
reason: "Audit tool sends diagnostic SQL snippets in feedback form"
Each field in the specification has an explicit operational purpose. The targetRef limits the blast radius of the object to a single routing manifest. The ruleId binds the exception to a single pattern from the compiled ruleset. The location field specifies where the parameter lives (such as QueryParameter, BodyParameter, Header, or Cookie), preventing an attacker from smuggling an attack through a query argument when only the JSON body parameter was meant to be excluded. The parameterName identifies the exact key within that location.
When multiple exceptions match a single incoming request, Envoy Gateway WAF exception management applies them independently. If an application receives a payload triggering rule 942100 on customer_notes and rule 941100 (cross-site scripting) on callback_url, both exceptions must be present for the request to pass cleanly. If only one exception exists, the unexcepted rule triggers a match.
Reading shadow events before you write an exception
Writing an exception before analyzing raw traffic patterns leads to poorly scoped exclusions. Shadow mode records what a rule would have blocked and lets the request through. Blocking is a separate, per-route promotion. Running routes in shadow mode reveals which parameters routinely trigger CRS patterns during normal business operations.
The console groups shadow events by rule, route, parameter, and a redacted excerpt. This grouping forms the direct operational input to your exception design.
A systematic triage sequence consists of four checks:
- Confirm the rule ID. CRS often triggers multiple rules sequentially. Identify whether the event stems from an initial protocol violation or a specific attack signature.
- Confirm the HTTPRoute. Verify that the path and hostname match the service experiencing the issue. Adjacent endpoints on the shared gateway have separate route definitions.
- Confirm the parameter and location. Inspect whether the matched string resides in a query string, a URL-encoded form field, a JSON object key, or a request header.
- Examine the redacted excerpt. Confirm whether the text matches expected business data, such as hyphenated product IDs or markdown strings. Discard events that contain executable shell syntax or database extraction strings.
Do not write an exception based on a single logged event. An isolated alert might indicate an actual vulnerability scan from an automated crawler. A genuine false positive demonstrates a consistent pattern across legitimate client sessions, tied directly to application functionality. You can read more about operational event observation in our article on Envoy Gateway WAF shadow mode.
Investigating false positives requires adequate log retention. The hosted console keeps 7 days on Free and 13 months on Pro. Self-hosted retention is yours to set. The data plane inspects requests inside your Envoy process and sends no traffic to Revetment. The hosted console is optional. Platform teams operating under strict internal audit windows can retain logs locally within their own logging infrastructure using standard Kubernetes log aggregators.
Choosing the scope: rule, route, parameter, or nothing
Troubleshooting WAF false positives requires choosing the narrowest defensible scope. The decision can be visualized as an operational ladder, progressing from the most conservative exception to broader exclusions:
| Exception Scope | Applied Target | Security Blast Radius | Recommended Application |
|---|---|---|---|
| Parameter-scoped | One rule, one route, one parameter | Minimal | Search bars, comment boxes, markdown fields, rich text |
| Route-scoped | One rule, one entire HTTPRoute | Moderate | Legacy machine-to-machine APIs with unstructured bodies |
| Multi-rule route | Multiple specific rules on one route | Elevated | Developer webhook receivers, administrative payload endpoints |
| Global rule disable | One rule disabled cluster-wide | High | Unsupported in Revetment; structurally unrecommended |
A parameter-scoped exception is the preferred resolution in Envoy Gateway WAF exception management. It handles cases where an input field legitimately receives characters that look like exploit primitives. A search box on a technical forum may receive raw strings like union select or boolean operators. Applying a parameter-scoped exception to the query key q leaves all headers, cookies, and other fields on that route protected by rule 942100.
A route-scoped exception covers situations where an application component receives arbitrary serialization formats that consistently violate specific CRS parsing rules across multiple fields. An API endpoint accepting raw YAML manifests from automated deployment pipelines may conflict with CRS generic attack detections. Applying an exception for that rule across the entire route avoids enumerating dozens of nested object keys, but it increases the review burden. The platform engineer assumes the responsibility of confirming that no input on that entire route relies on that rule for defense.
There are situations where the correct operational choice is to change nothing. If an event reveals an unexpected parameter carrying a shell payload or directory traversal string, the rule is performing as designed. In those cases, the payload is an active attack attempt. The engine blocked valid attack traffic. Creating an exception for an attack payload introduces an immediate vulnerability into the environment. When an exception is granted, document the operational reason, the owning team, and a review date directly in your configuration repository.
Troubleshooting WAF false positives that survive an exception
Deploying a RevetmentException CRD does not silence an alert in every case. When troubleshooting WAF false positives that persist after applying an exception, platform engineers should verify five diagnostic paths.
Diagnosis 1: The exception targets the wrong rule ID in a CRS rule chain
The OWASP Core Rule Set documentation outlines how complex rules operate across rule chains. A chain consists of an initial rule followed by one or more linked sub-rules. When a chain triggers, the log entry often records the final matching rule ID in the chain, while the primary rule ID that initiated the match is the one required by the engine. If an exception references the secondary rule ID, the filter engine will still match on the chain head. Verify your shadow event logs to confirm whether the alert belongs to a chained rule set, and ensure the ruleId field targets the root rule ID of the sequence.
Diagnosis 2: Path or hostname mismatch in the targetRef
A frequent root cause during Envoy Gateway WAF exception management is misaligned Gateway API selectors. If the targetRef references HTTPRoute/service-a, but incoming production traffic hits HTTPRoute/service-b due to overlapping path prefixes (such as /api/v1 versus /api), Envoy does not bind the exception to the active filter chain. Inspect the effective routing by running kubectl get httproute -A and matching the exact resource name handling the client request.
Diagnosis 3: Parameter encoding and name mutations
Applications and client frameworks often transform parameter names. Common examples include:
- Array notation appended by web frameworks, such as
filter[]instead offilter. - URL encoding differences, where spaces become
+or%20. - JSON path nesting, where the client delivers
{"user": {"notes": "..."}}instead of a flat key.
If the RevetmentException lists notes, but the parsed payload presents user.notes, the exception engine will not match. Check the exact parameter key recorded in the console's grouped shadow event output before committing