Quickstart
One minimal x-security policy, and three ways to ship it. Full field reference: x-security v0.8 schema.
The minimum viable policy
x-security is an OpenAPI extension: a block you add next to a route that declares the perimeter controls the route should have. This one pins JWT verification to asymmetric algorithms and throttles per authenticated user:
paths:
/users/{id}:
get:
summary: Get user by id
x-security:
authentication:
type: bearer-jwt
allowedAlgorithms: [RS256, ES256] # asymmetric only — alg:none has no spelling
bannedAlgorithms: [HS256, HS384, HS512, none]
rateLimit:
requests: 60
window: 60s
identifier: user-id # keyed by JWT subject, not IP
From here, pick your path. All three end at the same place: declared policy, enforced at the gateway.
Ship with your agent
- Install the plugin — Free · no card · no signup.
- Run
/x-security-scanin Claude Code or Cursor. Your own model reads the code; the bundled LLM-free CLI verifies every finding. - Verified policies land in
.x-security/policies/in your repo. Every finding citesfile:line. Nothing deploys automatically.
Write policies by hand
Add the block above to your OpenAPI file, then compile it to native gateway config:
$ xsecurity generate openapi.yml --target coraza --out ./wafLoad the emitted artifact into your gateway. Five self-hosted targets are supported — per-target load commands and capability coverage in the gateway matrix.
Gate CI on drift
Run xsecurity validate against the deployed gateway in CI:
# Exit 0: spec and gateway agree. Exit 2: critical drift — fail the build.
$ xsecurity validate openapi.yml --target kong --gateway http://kong:8001Exit code 2 means the deployed gateway disagrees with the spec on something critical. The build fails before the drift ships. Setup: CI drift gate.