Sessions are kept in a per-process map today, so only one webmail replica can run. This adds a second SessionBackend (the interface was written for it) that carries the whole session in its cookie, chosen with SESSION_BACKEND=cookie. The default is unchanged.
How it works
Cookie s1.<kid>.<sealed>: the record (id, username, account, OAuth tokens, times, remember) sealed with AES-256-GCM under a key derived from APP_SECRET. 643 bytes with realistic tokens; user agent and IP aren't carried, since nothing lists them in this mode.
Token renewal and the sliding expiry re-issue the cookie, for the front account and for the others in _more (multi-account), which now accepts the new shape and stays under 3,800 bytes for four others.
APP_SECRET_PREVIOUS (comma-separated) opens cookies from before a rotation; they are re-sealed under the current key on their next request.
Refuses to start in cookie mode without an explicit APP_SECRET (each replica would otherwise make its own) or without OAuth (OAUTH_CLIENT_SECRET): a sealed password can't be revoked.
What this mode can't do: list or end other sessions. /api/auth/sessions returns enumerable: false and only this session; revoke-others answers 409; the Security page shows only this device, hides "Sign out all other sessions" and says why. Changing the password still signs out everywhere, because the server invalidates every token for the account. Sign-out revoking its own tokens at the server is #104 (needs server #427); a full sessions list comes back with the server's grant registry (server #435, after 27.1).
Also documented in .env.example: use PUSH_MODE=relay with several replicas; subscribe mode fans out only to tabs on the replica the mail server calls back.
Strings: one new key, added to all 10 catalogs (1735/1735 in each, 0 falling back; was 1 falling back after adding the key).
Checked locally (ci.yml steps): typecheck, npm test (web 1599, server 297 incl. 7 new in sessions-cookie.test.ts), release-version.test.sh, build, i18n:check.
Also (second commit): sign-out revokes the tokens at the server.Closes#104. Needs a server with RFC 7009 revocation (inbuxa-server#438, 27.1); against an older one sign-out still works and, in cookie mode, logs that a copied cookie keeps working until its tokens expire. New test signout-revoke.test.ts (3). Local CI after this commit: typecheck ok, server tests 300/300, web tests pass, build ok, i18n:check ok. No new user-facing strings.
Closes #103 (K-W1, inbuxa for Kubernetes).
Sessions are kept in a per-process map today, so only one webmail replica can run. This adds a second `SessionBackend` (the interface was written for it) that carries the whole session in its cookie, chosen with `SESSION_BACKEND=cookie`. The default is unchanged.
**How it works**
- Cookie `s1.<kid>.<sealed>`: the record (id, username, account, OAuth tokens, times, remember) sealed with AES-256-GCM under a key derived from `APP_SECRET`. 643 bytes with realistic tokens; user agent and IP aren't carried, since nothing lists them in this mode.
- Token renewal and the sliding expiry re-issue the cookie, for the front account and for the others in `_more` (multi-account), which now accepts the new shape and stays under 3,800 bytes for four others.
- `APP_SECRET_PREVIOUS` (comma-separated) opens cookies from before a rotation; they are re-sealed under the current key on their next request.
**Refuses to start** in cookie mode without an explicit `APP_SECRET` (each replica would otherwise make its own) or without OAuth (`OAUTH_CLIENT_SECRET`): a sealed password can't be revoked.
**What this mode can't do:** list or end other sessions. `/api/auth/sessions` returns `enumerable: false` and only this session; `revoke-others` answers 409; the Security page shows only this device, hides "Sign out all other sessions" and says why. Changing the password still signs out everywhere, because the server invalidates every token for the account. Sign-out revoking its own tokens at the server is #104 (needs server #427); a full sessions list comes back with the server's grant registry (server #435, after 27.1).
**Also documented** in `.env.example`: use `PUSH_MODE=relay` with several replicas; subscribe mode fans out only to tabs on the replica the mail server calls back.
**Strings:** one new key, added to all 10 catalogs (1735/1735 in each, 0 falling back; was 1 falling back after adding the key).
**Checked locally (ci.yml steps):** typecheck, `npm test` (web 1599, server 297 incl. 7 new in `sessions-cookie.test.ts`), `release-version.test.sh`, build, `i18n:check`.
**Also (second commit): sign-out revokes the tokens at the server.** Closes #104. Needs a server with RFC 7009 revocation (inbuxa-server#438, 27.1); against an older one sign-out still works and, in cookie mode, logs that a copied cookie keeps working until its tokens expire. New test `signout-revoke.test.ts` (3). Local CI after this commit: typecheck ok, server tests 300/300, web tests pass, build ok, i18n:check ok. No new user-facing strings.
jcoffey-dev
added this to the 27.1 milestone 2026-11-18 06:43:22 +00:00
A second SessionBackend that seals the whole session into its cookie
(s1.<kid>.<sealed>, AES-256-GCM under a key derived from APP_SECRET), so any
replica can serve a session it never issued and the webmail keeps no state
of its own. The default stays the in-memory store with SESSION_FILE.
- Cookie mode needs APP_SECRET set explicitly and OAuth sign-in; it refuses
to start otherwise. A sealed password couldn't be revoked.
- Token renewal and sliding expiry re-issue the cookie, for the account in
front and for the other signed-in accounts in the _more cookie.
- APP_SECRET_PREVIOUS opens cookies sealed before a rotation and re-seals
them under the current key.
- The session list can't reach other sessions in this mode: the API says
enumerable: false, the Security page shows only this device and hides
"Sign out all other sessions". Changing the password still signs out
everywhere, through the server.
- The _more cookie accepts the new shape and stays under 3,800 bytes.
One new string, translated in all ten catalogs.
With cookie sessions there is nothing on this side to delete, so signing
out (one account or all) now revokes the refresh and access token through
the server's RFC 7009 endpoint, read from its OAuth metadata. A copy of
the cookie then gets 401. A server without revocation still signs out,
and in cookie mode a warning says the copy works until the tokens expire.
Closes#104
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #103 (K-W1, inbuxa for Kubernetes).
Sessions are kept in a per-process map today, so only one webmail replica can run. This adds a second
SessionBackend(the interface was written for it) that carries the whole session in its cookie, chosen withSESSION_BACKEND=cookie. The default is unchanged.How it works
s1.<kid>.<sealed>: the record (id, username, account, OAuth tokens, times, remember) sealed with AES-256-GCM under a key derived fromAPP_SECRET. 643 bytes with realistic tokens; user agent and IP aren't carried, since nothing lists them in this mode._more(multi-account), which now accepts the new shape and stays under 3,800 bytes for four others.APP_SECRET_PREVIOUS(comma-separated) opens cookies from before a rotation; they are re-sealed under the current key on their next request.Refuses to start in cookie mode without an explicit
APP_SECRET(each replica would otherwise make its own) or without OAuth (OAUTH_CLIENT_SECRET): a sealed password can't be revoked.What this mode can't do: list or end other sessions.
/api/auth/sessionsreturnsenumerable: falseand only this session;revoke-othersanswers 409; the Security page shows only this device, hides "Sign out all other sessions" and says why. Changing the password still signs out everywhere, because the server invalidates every token for the account. Sign-out revoking its own tokens at the server is #104 (needs server #427); a full sessions list comes back with the server's grant registry (server #435, after 27.1).Also documented in
.env.example: usePUSH_MODE=relaywith several replicas; subscribe mode fans out only to tabs on the replica the mail server calls back.Strings: one new key, added to all 10 catalogs (1735/1735 in each, 0 falling back; was 1 falling back after adding the key).
Checked locally (ci.yml steps): typecheck,
npm test(web 1599, server 297 incl. 7 new insessions-cookie.test.ts),release-version.test.sh, build,i18n:check.Also (second commit): sign-out revokes the tokens at the server. Closes #104. Needs a server with RFC 7009 revocation (inbuxa-server#438, 27.1); against an older one sign-out still works and, in cookie mode, logs that a copied cookie keeps working until its tokens expire. New test
signout-revoke.test.ts(3). Local CI after this commit: typecheck ok, server tests 300/300, web tests pass, build ok, i18n:check ok. No new user-facing strings.jcoffey-dev referenced this pull request from inbuxa/inbuxa-charts2026-11-18 08:33:44 +00:00