Two ways in, both found by auditing the new assistant against the live site.
**The model id was not an allowlist.** `/api/chat` accepted any string under
120 characters and handed it to ai-kit, which resolves a model it cannot find
in the chain by PREPENDING it — so an unrecognised id is the first thing tried,
against our key. The chain is free only because every id in it is free; the same
OpenRouter key will happily serve a paid model. Probing live confirmed it: a
fabricated id was accepted without complaint, and unauthenticated GET /api/chat
advertises that OpenRouter is keyed, which is the reconnaissance step. The only
other gate is Origin header equality, which curl forges.
Now `isOfferedModel()` is the single answer to "may we send this", the route
refuses anything else with a 400, and `answerQuestion` forwards only an id it
matched in the chain — so even a future caller that skips the route cannot pass
a string through to a provider.
**Fact-check was an anonymous write to public content.** It took no session,
spent one or two completions per call, and inserted into the same thread a human
needs an account to post in — because page-thread only enforces `canWrite` for
human authors, so the `ai` kind was never a second gate. Any visitor could put
machine-written comments on every note and learn page, permanently, 20 an hour,
and bill us for it. It needs a session now.
Also: `allowRequest` throws when AUTH_SECRET is unset, and in comments and
fact-check it sat outside the try, turning a missing variable into a raw 500
instead of the 503 the rest of each file is written to produce. And /api/follow
was the one authenticated write with no throttle, on a read-modify-write of a
row the caller controls.
The guard is proved by mutation: make `isOfferedModel` return true and two tests
fail.
Claude-Session: https://claude.ai/code/session_01Y6ecRd91ZsPPcjuNkKTFV2
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Replace the hand-drawn SVG with react-simple-maps (Equal Earth).
Notes, learn, and bottleneck pages get comments (threadkit) and a
corpus-grounded fact-check button. Ask shows whether ai-kit is
configured. Same complete() engine as Cat and Loki — not the Cat UI.