Files
FFF_vtt_frozen/docs/adr/0018-session-not-key-plaintext-keys.md
T
SirStone 8aaf03be04 docs: add ADRs for the durable design decisions
22 ADRs: server-authoritative sight and single egress, per-recipient views/diffs, uniform
nack, opaque ids, 32 px tile unit, wall switches/presets, see-over, thick walls, open-door
gap, typed wall columns, proto 2, build order, zoom clamp, accepted status leak, player
marker, chunked explored, slow-client policy, session/key split, closing message, character
records, global lock, synchronous choice. Each links its tickets and its spec section.
2026-11-17 23:12:04 +01:00

1.6 KiB

Session tokens are separate from keys, and keys stay plaintext

A player key is a 20-symbol secret the GM creates and can re-show; signing in with it issues a separate random 32-byte session token, stored only as its SHA-256 hash, in an HttpOnly; Secure; SameSite=Strict cookie. Sessions never expire; one key works on several devices; replacing a key invalidates the old key, revokes all that player's sessions and closes live connections. Keys stay plaintext so the GM can re-show them. We rejected hashing keys at rest and per-person invite links because the GM must be able to re-copy a key, the key space is ~99 bits so hashing buys little against guessing, and one link per player is the simpler sharing model.

Status

accepted

Alternatives

  • Store only a key hash and regenerate on loss: rejected, the GM loses the ability to re-show.
  • Make the key the session cookie (prototype): rejected, a permanent bearer in logs and history.
  • Expiring sessions: rejected, a home table re-signs in rarely and expiry only annoys.
  • Per-person invite links: rejected in favour of player keys.

Consequences

The key never appears in a URL or a log (redaction is a safety net, not the rule). Removing a player invalidates the key, revokes sessions and hands their characters and tokens to the GM. The GM key is created only by the CLI and rotates only with --new, which refuses while the server holds the state-dir lock. The web server terminates TLS and the binary binds 127.0.0.1.

Tickets

#6 (players and keys), #17 (auth slice), Q10, Q11.

Spec

Current §3.2, §6.6, §8.