Status: Accepted (2026-11-27). Details and threat model: ../architecture/security.md.
crypto.argon2 (m=64 MiB, t=3, p=1, 16-byte salt, PHC string). Constant-time compare; generic “invalid credentials”.linora_session cookie (HttpOnly; Secure; SameSite=Lax; Path=/, __Host- prefix in production), stored as SHA-256 only, 30-day sliding expiry, rotated on login and privilege change. CSRF: SameSite=Lax + mutating requests must be JSON (Content-Type: application/json) with an allowed Origin, plus a double-submit X-CSRF-Token for all non-GET routes.kid. Revocation: API NOTIFY -> realtime closes affected sockets; a denylist of revoked credential ids is kept for one token TTL.linora_pat_ + 32 random bytes, SHA-256 at rest, shown once, scopes (files:read, files:write, projects:admin), optional project allow-list and expiry, last_used_at, revocable.shared/src/api.ts); role is resolved from project membership of the path’s project/file (tenant isolation). Realtime: role and scopes come from the signed token and are re-checked on every OPS frame (viewer -> read_only). Role changes and removals push file_event and close or downgrade sockets.unsafe() outside migrations.limits.ts); token buckets per connection, user, PAT and IP (login and signup stricter); WS connections per user and per IP.audit_log for membership, role, token, project/file deletion and login failures (rate-aggregated); readable by project owners.LINORA_TOKEN_KEYS, DATABASE_URL, blob credentials), never committed; .env is gitignored; startup fails if missing.X-Content-Type-Options, Referrer-Policy, frame-ancestors none.JWT sessions for the browser (revocation harder), Ed25519 realtime tokens (only needed if third parties verify; 50x slower), OAuth for MCP now (PATs first; OAuth 2.1 later per MCP spec).
Every new route must declare scope + role; a test enforces it (shared/test/schema.test.ts). Security review is part of CONTRIBUTING for auth/limits changes.