Skip to content

How inspection works ​

Every request to a protected application is checked by an inspection service before it reaches your server. The checks run in a fixed order and stop at the first refusal. Each application has its own policy, and every decision is recorded with the reason for it.

What it is made of ​

PartWhat it does
Data planeThe pinned Envoy. It terminates TLS, balances servers and sends each request to inspection.
Inspection serviceRuns the application's checks (modules) on the request and on the response.
Control planeHolds the versioned configuration and pushes it to both. It also serves the console and the management API.
UpstreamYour server. It sees only requests that passed.

The path of a request ​

The client connects to the data plane. For each request, Envoy sends the headers and the buffered request body to the inspection service over a local socket (ext_proc). The service answers with a verdict. Envoy then forwards the request, or sends the block page itself. The response comes back the same way: Envoy sends the response headers to inspection, which may edit them or mask data. Response bodies are sent only when a response check needs them.

The control plane is not on this path. It pushes configuration to Envoy over xDS and to the inspection service, and the management API never listens on the data-plane listener. For the layouts that place these roles on one or several hosts, see Deployment layouts.

Applications and policies ​

An application is a protected backend: host names plus a server pool. Envoy tells the inspection service which application a request belongs to, and the service runs that application's policy. A policy is the set of enabled modules and their settings. Nothing is shared between applications except the settings that apply to every one.

The order of the checks ​

Each application gets its own list of modules, built from its policy. A module that is not configured is left out. The request runs through them in this order.

StepModule (as named in events)Runs only when
1accessAlways. Bans apply even without access rules.
2cookiesCookie protection is set. It opens sealed cookies so later checks see real values.
3sessionsSession protection is set.
4csrf, then corsEither is set.
5botsBot mitigation is set.
6api_authAPI authentication is set.
7identity, then attestClient identity or app attestation is set.
8rate_limitsRate rules, a concurrency limit, bans or learned volume limits exist.
9api_schema, ws_security, xml_schemaAPI protection is set.
10filesFile upload checks are set.
11positiveThe positive model is active.
12bola, flows, ssrfThe matching API or outbound protection is set.
13signaturesSignatures are enabled.
14scorerulesCustom rules on attack and automation scores exist.

After the request checks, the same list runs again on the response with the response-side parts: signatures on the answer, rewrite, ws_security signing, headers, llm_guard, dlp and discovery. The pipeline is built in internal/inspect/apps.go (Builder.modules). Early checks are cheap and stop most unwanted traffic before the costly signature engine runs. A refusal ends the run at once, so a request refused by access never reaches signatures.

For a description of each module, see Modules and rule IDs. To see the stages an application really runs, use Trace a request.

Modes ​

Mode decides whether a finding stops the request.

  • detect logs what the check would have done and lets the request pass.
  • block stops the request.

An application has a mode, and each module may have its own. New applications start in detect. A module in block inside an application in detect only logs. The one exception is a virtual patch whose enforce is set to block: it refuses the request even in detect, so one proven patch can protect while everything else is still being watched. For details, see Modes and limits and Virtual patches.

Verdicts ​

A module returns one verdict for the request.

VerdictMeaning
allowNothing found. Nothing is recorded.
logSomething is worth recording. The request passes.
challengeThe client must prove it is a browser or a person first.
blockThe request is refused with the application's block page.

In detect, a block or challenge is lowered to log, and the event records that it would have blocked. The final decision is the strongest verdict reached before the run ends.

How signatures score ​

The signatures module runs OWASP CRS v4 and our own rules with the Coraza engine. A single rule match does not block. Each match adds points to an anomaly score, and the request is acted on when the score reaches the inbound threshold (default 5). Responses use the outbound threshold (default 4).

The paranoia level (1 to 4, default 1) decides how many rules run. Higher levels catch more and cost more false positives. Before the protocol and attack rules run, a pre-filter skips each rule whose required text appears in none of the values it reads. The result is the same as running every rule, and only the time changes. For details, see Paranoia and thresholds, Rule pre-filter and Signatures.

Time budgets ​

Each module has a time budget per request (policy.limits.module_budget, default 50ms). What happens at the budget depends on the result.

  • A module that returns an error at its budget has failed. The failure policy decides.
  • A module that finishes late with a refusal (block or challenge) still acts on it, because the time is already spent. The event and the trace keep the overrun.
  • A module that finishes late with nothing to refuse (nothing found, or only a log finding, which is still recorded) counts as a failure, and the failure policy decides.

The failure policy ​

Inspection can fail: a module returns an error or panics, a module hits its budget without a result, or Envoy cannot reach the inspection service. Each application sets policy.on_inspection_failure.

ValueEffectDefault
fail_openThe request passes and the failure is recorded.yes
fail_closedThe request is refused with 503.no

The setting applies inside the pipeline and also tells Envoy what to do when the inspection service is unreachable, per application. A panic in a module is caught at the pipeline boundary, logged without request data, and treated like any other failure.

fail_closed turns an inspection outage into an application outage

Use it only where a missed attack costs more than downtime.

Limits ​

Every request is bounded: body size, header count and bytes, number of parameters, nesting depth of JSON and XML, and the time per module. An over-limit request is refused with 413 or 431 and an event says why. Defaults and ranges are in Limits and defaults.

Every decision is explained ​

When a module blocks, challenges or logs, the event records the application, the module, the rule ID, the matched variable, the matched value, the action taken and the mode. A decision that cannot be explained is a defect. By default values are stored in full; an application can mask credentials, cookies and card numbers. For details, see Events and Trace a request.

How changes take effect ​

You change a policy as a new configuration version. The control plane validates it, then pushes it to the inspection service and Envoy without a restart.