docs(website): add API v2 plan (auth merge, CSP hardening, domain split) #45
Reference in New Issue
Block a user
No description provided.
Delete Branch "docs/api-v2-plan"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds
website/API_V2_PLAN.md— the design plan for website API v2. Docs-only; no code changes.What v2 is
Two sequenced pieces of work landed behind a parallel
/api/v2(v1 frozen, migrate the client route-by-route, retire v1 last):Phase 1 — the auth merge. Retire httpOnly session cookies; unify web + mobile on the bearer access + rotating/revocable refresh model that mobile already has (
mintMobileTokens/refreshMobileSession). The merge is mostly deletion — web joins the mobile session model and the/auth/mobile/*namespace collapses into plain/auth/*. Two constraints called out explicitly:Authorization: Bearer(EventSource can't send headers), preserving the public/admin allowlist boundary.Phase 1b — CSP hardening. Once the token lives in JS, CSP's job is "injected script can't run and can't phone home." Tightens the already-shipped policy: add
form-action 'self',frame-ancestors 'self'→'none'; keepscript-src/connect-srcat'self'. Self-host fonts + Trusted Types (report-only rollout) tracked as follow-ups.Phase 2 — the domain split. Break the monolithic route wiring (
admin.routes.js, ~100 routes / 14 controllers) into one router per business capability so the URL predicts the file. Controllers are already domain-split; this is re-wiring, not re-logic.Notes
AI-assisted: authored with Claude (Claude Code). See the commit's
Co-Authored-Bytrailer.🤖 Generated with Claude Code
https://claude.ai/code/session_01NgyHnrNa8WwG3doxvxjuCr