Policy packs
Bind a WAF policy to a virtual host. Override mode per server or longest-prefix route. Logical service labels ride in every log line.
Edge security · OpenResty hot path
Bind policies per domain and route. Run in monitor or block. Stage signatures safely. Every decision names the policy, binding, stage, signature, and a support ID — fail-open by default so a WAF bug never takes the site down.
Not a regex snippet — a governed policy engine with stable signature IDs, anomaly scoring, and structured events.
Bind a WAF policy to a virtual host. Override mode per server or longest-prefix route. Logical service labels ride in every log line.
Transparent (alarm) and blocking enforcement modes. Route overrides let /preview stay in monitor while /api/pay blocks.
Each signature contributes a score. When the cumulative total crosses the policy threshold, VIOL_ANOMALY_SCORE fires — even if no single rule alone would block.
Disable by ID, stage until a timestamp (alarm-only), or toggle whole sets (SET_SQLI, SET_XSS…). Staged rules never inflate anomaly scores.
JSON depth and size profiles, XXE / SSTI / mass-assignment signatures, and optional parse hardening on the request path.
Response headers X-WAF-Block, X-WAF-Rule, X-WAF-Violation, X-Support-ID plus a block page that embeds the correlation ID.
After rule match and rate limit, waf_engine.inspect runs first-class stages, then governed signature matching — each stage is fail-open under pcall.
VIOL_METHOD
Reject verbs outside the policy allow set (for example GET / POST / HEAD / OPTIONS only).
VIOL_FILETYPE
Block paths ending in sensitive extensions — .env, .sql, .bak, .git, .pem, and more.
VIOL_SMUGGLING
CL+TE coexistence, duplicate or obfuscated Transfer-Encoding, malformed Content-Length — plus a body signature for pipelined request lines.
VIOL_IP_DENY · VIOL_GEO
CIDR allow/deny lists and country deny via IP2Location on the hot path.
VIOL_JWT_ALG
Deny none / weak algs; require RS256 or ES256 for APIs that carry bearer tokens.
VIOL_JSON_*
Max depth and max bytes before the request reaches your origin.
VIOL_BRUTE_FORCE
Per-path windows (for example /api/login) keyed by IP — block or alarm when attempts exceed the budget.
VIOL_OPENAPI_*
Declared path + method allow-list with path templating — unknown surface never reaches the backend.
Stable IDs under data/waf_rules/ — seedable via API, editable in Admin UI, pullable with wslproxy-cli.
Each signature declares category, severity, match target (url · args · body · headers · cookies · user_agent · all), action, and anomaly score. Policies attach rule IDs; sets group them for bulk block/alarm toggles.
Security is not only signatures — routing rules and gateway pipeline features close the gaps attackers use.
Shared-dict rate limits with requests-per-second and burst — applied in the gateway pipeline before expensive origin work.
Rule status 306 serves Turnstile or reCAPTCHA until a signed cookie proves the client cleared the challenge, then continues as a normal proxy (305).
JWT validation, Amazon S3 signing checks, and cookie key-value gates on the rule matcher — deny before the backend ever sees the request.
Independent of WAF geo stages: route or block by country and client CIDR with equals / not-equals keys on live rules.
Govern in UI or GitOps. Validate in CI. Ship events to your SIEM.
WAF Policies and WAF Rules forms cover v2 fields — bind to servers, override mode, review events.
CRUD via Swagger, bind policies from MCP tools, wslproxy-cli pull/push for waf_rules and waf_policies.
tools/waf_validate.py + waf-validate workflow — Lua syntax, JSON Schema policies, signature referential integrity.
Structured wafsec JSON logs, Prometheus counters (waf_blocked, waf_monitored, latency), recent events API.
Read the engine design, seed rules in your profile, bind a policy to a server, and start in monitor mode before you flip to block.