Linora

0310. Per-purpose token keys and least-privilege database roles per tier (SR-07)

Status: Accepted (2026-11-28). Refines 0011 (token keys) and 0021 (table ownership, now enforced by Postgres). Role names, the HKDF salt and the variable names updated by 0028 (2026-11-30).

Context

Security finding SR-07 (Medium). One HMAC keyring (LINORA_TOKEN_KEYS) signed every token type, and every tier connected with the same database role. The doc worker parses attacker-shaped documents and runs resvg, so it is the most exposed tier. With code execution there, it could mint a realtime token for any user, file and role, or write any table directly.

Decision

Alternatives

Consequences