Browser sessions of the forge server now survive a restart
The forge server of BRUTAL kept pending logins and browser sessions only in process memory. Every restart, deploy or crash signed every browser out, and a login in flight failed at its callback. With a new optional environment variable, normal serving now keeps both in a small store of their own, outside the encrypted object store. Without the variable, sessions stay in memory as before.
Each login or session is one file, sealed with XChaCha20-Poly1305 under the control vault's key, the suite the object store already uses, with no new dependency. Every write needs current service authority. A record is bound to its purpose and its store, so a copied record fails to open. Tokens, PKCE verifiers and nonces never reach the disk unsealed, and the cookie still carries only a random handle. The limits stay: logins 300 s, sessions at most 8 h, at most 1024 of each.
The store fails closed. A record of the current key epoch that does not authenticate, missing service authority, foreign files or a second server on the same directory stop the start, with no fallback. Records of another key epoch are discarded, so a key rotation signs everyone out. A sign-out reports success only after its record is removed from the disk.
Reopened in the same process, the store's lock briefly looked busy, because a child between fork and exec held a copy of its descriptor: one test failed in 15 of 200 parallel runs. The open now retries the lock for at most 2 s, and the store tests then passed in all 200. A full source check in lanes was green with 53 test result: ok and 0 failed. At the merge, the acceptance script with a real browser had no restart step yet.
Sources
- #175 814dc0c