🐛 Patch Changes
- 77a1db3: Backend hot-path and dashboard query optimization pass: 60s LRU session cache in SessionGuard, slimmed AgentKeyAuthGuard query with 30min cache, retuned specificity miscategorization index, batched proxy fallback inserts, merged agent-list stats+sparkline into a single query, bounded distinct-models scan to 90 days, plus typed SSE events so dashboard pages only refetch on relevant changes instead of every ingest ping.
- a5f0ef9: Security audit fixes (OWASP review).
- Auth: SessionGuard and AgentKeyAuthGuard now read
request.socket.remoteAddressfor the loopback bypass decision instead ofrequest.ip, which is forgeable viaX-Forwarded-Forwhentrust proxyis enabled. The productiontrust proxysetting is narrowed toloopback, linklocal, uniquelocal(override withTRUST_PROXYenv). - Proxy: custom-provider and subscription endpoint URLs are revalidated against the SSRF allowlist immediately before each forward (DNS-rebinding defense). All proxy
fetch()calls now useredirect: 'error'to block redirect-based escalation. - Auth rate limiting: added per-endpoint limits for
sign-up,forget-password/forgot-password/reset-password, andverify-email/send-verification-email(Better Auth runs outside NestJS soThrottlerGuarddoesn't apply). - ApiKeyGuard: DB-API-key path now populates
request.user, so user-scoped controllers no longer crash with a 500.@CurrentUser()fails closed with a 401 when no user is attached. - Crypto: AES-GCM IV length set to the standard 12 bytes (was 16), scrypt-derived keys cached per (secret, salt) to remove the per-call ~50ms cost on the proxy hot path. Boots warns once when
MANIFEST_ENCRYPTION_KEYfalls back toBETTER_AUTH_SECRETin production. - OAuth:
backendUrlis validated against the allowlist at storage time instead of being trusted on the way out. - Telemetry:
routing_tierandauth_typebuckets are whitelisted against the shared enums; unknown values collapse to"other"instead of leaking verbatim. - Frontend: 401 responses no longer force a redirect to
/loginfor per-endpoint auth failures. Only session-shaped 401s log the user out. - HSTS: warns at boot when production runs without HSTS on a non-loopback bind. Silence with
MANIFEST_DISABLE_HSTS=1. - Dev CORS: defaults to a single origin (
http://localhost:3000); setCORS_ORIGINfor anything else.
- Auth: SessionGuard and AgentKeyAuthGuard now read