Delete unused login and invite tokens on a daily job, and keep their URLs out of logs.

Expired sign-in, save-progress, email-change, and invitation tokens (and any draft they carry) are cleared by a Cloudron scheduler task. Page timing logs record the path without the query string, and mail failures log a request id instead of an address.
This commit is contained in:
adilallo committed 2026-11-10 15:34:33 -07:00
1 parent 73d0856004
commit 46c34a6323
28 files changed
+636 -45

No files matched your search

+4 -2
View File
@@ -21,11 +21,13 @@ import { hashSessionToken, newSessionToken } from "./hash";
* 2. **Rotation: deferred.** No token rotation on privilege-sensitive
* actions in v1. Revisit if/when product requires it (ticket calls
* this v1.1).
* 3. **Cleanup: lazy, two-tier, no cron.** Every sign-in prunes the
* 3. **Cleanup: lazy plus a daily job.** Every sign-in prunes the
* signing user's own expired rows (cheap — uses `@@index([userId])`).
* A small fraction of sign-ins (`SESSION_GLOBAL_PRUNE_PROB`) also runs
* a global sweep so rows from users who never return are still bounded
* over months. Cleanup is best-effort: a prune failure never fails the
* over months. Cloudron also runs `scripts/prune-sessions.ts` daily
* (expired sessions, unused links, and old workshop inquiries).
* Cleanup on sign-in is best-effort: a prune failure never fails the
* sign-in itself.
* 4. **Email change (CR-103).** After a verified email update, revoke every
* `Session` for that `userId` **except** the current browser's session when