design: mark sign-in path and ws origin check fixed (#17)

This commit is contained in:
2026-11-14 22:13:25 +01:00
parent 8ff66530d8
commit 527e216c37
+2 -2
View File
@@ -124,7 +124,7 @@ Notes:
### 3.2 Authentication: shared link, player keys, GM key
- **Shared site link [FIXED, #6].** One link for everyone: `https://host/`. Without a session it shows only the sign-in page, no data.
- **Player key [FIXED, #6].** Each player has a personal secret, the **player key**, generated by the GM (no name at creation). It identifies the player and grants access to their data. Format: 20 characters in groups of 4 with dashes, alphabet without look-alikes (no 0/O, 1/I/L), from the OS CSPRNG (~100 bits) [FIXED, owner accepted default, #6].
- **Sign-in [PROPOSED path; behaviour FIXED].** The sign-in page POSTs the key to `/join` (HTTP; key in the body, never in the URL). Valid key: the server issues a fresh random session token cookie (`HttpOnly; Secure; SameSite=Strict; Path=/`), stores only its hash server-side, then redirects to `/`. Request and response: 6.6. Sessions never expire (Q10); one key works on many devices [FIXED, Q10].
- **Sign-in [path FIXED (owner-delegated, 2026-11-14, #17): `POST /join` implemented in slice 2; behaviour FIXED].** The sign-in page POSTs the key to `/join` (HTTP; key in the body, never in the URL). Valid key: the server issues a fresh random session token cookie (`HttpOnly; Secure; SameSite=Strict; Path=/`), stores only its hash server-side, then redirects to `/`. Request and response: 6.6. Sessions never expire (Q10); one key works on many devices [FIXED, Q10].
- **First-sign-in name [FIXED, #6].** A player with no name is asked once for a display name (`player.setname`, 6.1). Names are unique among players. Renames: GM only (`player.rename`).
- **No rate limit on key entry [FIXED, owner, #6].** The ~100-bit key space makes guessing infeasible; no lockout, no `limit_req` on sign-in. Owner explicitly rejected guessing protection.
- **Replace a key [FIXED, #6].** GM can do this any time while the server runs: old key invalid, all that player's sessions revoked, live connections closed at once. Identity, characters and encountered list kept; no name re-prompt.
@@ -133,7 +133,7 @@ Notes:
- Keys are stored plaintext so the GM can re-show them [FIXED, Q11]. Key and session are separate: the cookie is never the key. Never log keys or session tokens (Nim or nginx).
- Session separate from key: the prototype's secret-as-cookie design is dropped (permanent bearer, sits in access logs and history).
- One cookie jar = one identity; same cookie in two tabs = same player, shared vision, both connections synced [MEASURED, prototype README].
- WS upgrade: authenticate by cookie **and** verify the `Origin` header equals the configured public origin [PROPOSED; mitigates cross-site WebSocket hijack, SameSite=Strict is the first line].
- WS upgrade: authenticate by cookie **and** verify the `Origin` header equals the configured public origin, checked before the session and the upgrade [FIXED (owner-delegated, 2026-11-14, #17); mitigates cross-site WebSocket hijack, SameSite=Strict is the first line].
- **Rejected [FIXED, #6]:** per-person invite links; GM types the name at key creation; delete-and-reinvite only; deleting a player's characters with the player; a shared-link visit creating a player; a separate GM link path.
- **First GM login [FIXED, owner decision 2026-11-10, #5; amended #6].** Only the server CLI creates the GM: `fff-vtt gm-key` creates the single GM player (role `gm`, display name `GM`) if none exists, and prints the GM key. Re-running prints the same key; existing GM sessions are unaffected. `fff-vtt gm-key --new` rotates: new GM key, old one invalid, all GM sessions revoked. `--new` refuses while the running server holds its lock on the data dir; the read-only print works at any time. The GM's own key rotates only this way (no live replace). The GM signs in like a player: shared link, then GM key. Access control is filesystem permissions on the data files; no extra password. A visitor without a key never becomes GM (no first-visitor claim); they see only a "need a key" page. The GM may rename.
- Rejected: env/config seed (secret leaks via config, repo, backups); auto-print at startup (secrets in logs); first visitor claims GM (takeover); rotate on every lookup (logs out GM devices); live rotation while the server runs (needs an admin channel to the running server).