Linora

0302. CSRF token delivery, session-only token management, PAT restrictions

Status: Accepted (2026-11-27). Refines 0023 items 2 and 4. 0905 adds host-scoped non-Secure cookies for listed plain-HTTP LAN origins, and makes the prod-like edge forward Host (the same-origin check below never matched through it before). Cookie and header names updated by 0028 (2026-11-30).

Context

ADR 0023 requires a double-submit X-CSRF-Token, but does not say how the web app gets the token. MeRes has no field for it, and the contract is frozen. PATs are bearer credentials for agents and scripts. If a PAT could mint PATs, one leaked files:read token could escalate to projects:admin.

Decision

Alternatives

Consequences

The web shell (WP-D) reads X-CSRF-Token after signup, login or me and sends it on every mutation. In dev it proxies /v1 through Vite, so requests are same-origin. Agents need a human to create their PAT in the UI. That is the intended trust boundary.