Stop hand-writing WAF config for every gateway. Write one security policy. Compile it to all of them.
Your API gateway and WAF already ship auth, rate limits, request validation, and ownership checks, off by default. x-security is one policy per route, an extension of the OpenAPI spec you already have. A deterministic CLI compiles it to seven gateways. Versions in git. Drift fails CI.
- 7 gateway targets
- 17+ policy categories
- deterministic · no API keys
# GET /users/:id one route, one policy
authentication:
type: bearer-jwt
allowedAlgorithms: [RS256, ES256] kills alg:none
authorization:
type: rule-based
rules:
- field: resource.ownerId
operator: equals
value: { ref: jwt.sub } BOLA defense
rateLimit:
per: user-id not IP
window: 60s
max: 60
response:
headers:
csp: "default-src 'self'"
hsts: { maxAge: 31536000 }The security is already in your gateway. You're running it on defaults.
Turning that protection on means learning each vendor's config language, and the rules you write lock you into that vendor, live outside your codebase, and drift out of sync with the API they protect. So the defaults stay, wide open, because the alternative is a config project per gateway.
x-security flips that: one policy per route, in the OpenAPI file you already have — portable, versioned in git, drift-gated in CI.
of organizations hit an API security incident last year. Same OWASP categories every time: broken object-level auth (API1), broken authentication (API2).
Salt Labs · State of API Security 2025From your code to an enforced policy. Four steps, one spec.
The policy stays in source control the whole way. Every rule cites file:line and is byte-verified against your code before it compiles to a gateway rule.
One x-security block per route, in the OpenAPI file you already have. Write it by hand or with the visual builder — it versions in git and diffs like code.
x-security: { … }Verified, or not enforced.
Three rules decide what ever reaches a live gateway. Anything unproven is dropped, not shipped.
Byte-verified citations
Every rule cites file:line and is byte-verified against your code.
Nothing unproven ships
Unverifiable findings are dropped to reviewRequired and never enforced.
Log before block
Shadow mode where the gateway supports it natively.
Known limitations →·The x-security schema is open — read the source ↗
Compile to the gateway you already run.
One spec, 5 self-hosted compile targets and 2 hosted deploys — switch gateways without rewriting a line of policy. Per-gateway support matrix →
What compiles where, and what it actually blocks.
Pick your gateway, and the coverage recomputes from the ceiling to your reality. Honest per target: every gap is flagged instead of rounded up.
The most x-security can enforce at the perimeter, given an identity-aware gateway. Pick your stack to see your reality — gaps and all.
Cloudflare, AWS and BunkerWeb are independently measured today; other targets compile the same policy, not yet per-class measured. Full per-class, per-field matrix →
All delivery targets (7 gateways, 9 rows)
| Target | What it is | Delivery | Status |
|---|---|---|---|
cloudflare | Cloudflare Ruleset Engine + WAF | hosted deploy | GA |
aws-apigw | AWS API Gateway + WAFv2 | hosted deploy | beta |
kong | Kong Gateway (decK plugin) | self-hosted bundle | beta |
coraza | Coraza / ModSecurity WAF | self-hosted bundle | beta |
coraza · nginx | NGINX + libcoraza (preset) | self-hosted bundle | beta |
bunkerweb | BunkerWeb (OpenResty WAF) | self-hosted bundle | beta |
openappsec | Check Point Open AppSec | self-hosted bundle | beta |
envoy | Envoy (ext_proc / Lua) | self-hosted bundle | alpha |
firewall | Host firewall (iptables) — SSRF egress only | self-hosted bundle | — |
NGINX ships as a Coraza preset and the host firewall is an SSRF-egress adjunct, not standalone gateways, so seven gateways, nine rows.
One spec. Every gateway. Apache-2.0.
x-security is 100% open source. Read the spec, install the CLI, compile to your gateway. Star the repo to follow the schema — changes are versioned and tagged.