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 with400 INPUT_TOKEN_LIMIT_EXCEEDEDbefore any provider sees it (a413up 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 —
wafPromptFloodThresholdnear-identical prompts allowed per identity perwafPromptFloodWindowSec(default 60s); the next is refused with429 PROMPT_FLOODandRetry-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) ormonitor(serve, alarm, and tag the usage rowwaf_ai_abuse). - Refusals write a Blocked usage row (
blockCodeinput_token_limit_exceeded/prompt_flood) and raise a throttled alarm in the rate-limit alarms dashboard +security.rate_limit_exceededwebhook + 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) orblock(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.