Skip to content
Docs

Web Application Firewall

Rules: SQL injection (ON), XSS (ON), command injection (ON), path traversal (ON), custom rules, whitelist paths. These are platform-wide (one configuration, super admin). AI-specific abuse controls (2.0.412, per organization, all OFF by default):

  • Token stuffing — wafMaxInputTokens: a request whose estimated input exceeds the cap is refused with 400 INPUT_TOKEN_LIMIT_EXCEEDED before any provider sees it (a 413 up to 2.0.427, which Claude Code misreports as “Request too large (max 32MB)”). The estimate is the same counter the context-fit preflight uses (content + per-message envelope + templated tool schemas).
  • Prompt flooding — wafPromptFloodThreshold near-identical prompts allowed per identity per wafPromptFloodWindowSec (default 60s); the next is refused with 429 PROMPT_FLOOD and Retry-After. Near-identical = same final user message after lower-casing, removing digits and collapsing whitespace, or ≥85% estimated shingle similarity. Agent tool-loop turns (ending in a tool result) are never counted.
  • Mode — wafAiAbuseMode: enforce (refuse) or monitor (serve, alarm, and tag the usage row waf_ai_abuse).
  • Refusals write a Blocked usage row (blockCode input_token_limit_exceeded / prompt_flood) and raise a throttled alarm in the rate-limit alarms dashboard + security.rate_limit_exceeded webhook + email. Applied on every gateway route and the Connect relay; not on multipart uploads (no prompt text) or super-admin sessions (exempt, as for rate limits).
  • Configure: Settings → Rate Limiting → AI abuse controls (WAF), or GET/PUT /api/admin/waf/ai-abuse. The request body size cap (default 50 MB on /v1/*) and per-user / per-key / global rate limits (Section 6.1) still apply alongside them. Modes: detect (log) or block (reject). DDoS: rate limiting + IP allowlisting (CIDR) + circuit breakers form a defense-in-depth chain — production deployments front this with HAProxy or a cloud WAF (CloudFront/AWS WAF, Cloudflare, Azure Front Door) for L3/L4 absorption. APIs: config, violations, stats.