Files
Daniel Salazar 6b8af52077 feat(auth): sign-in pipeline, per-account wrong-password budget and idle session expiry (#4692)
Sign-in
- One sign-in path (SignInService) for password, 2FA, recovery code, signup
  and OIDC. It emits puter.signin.attempt (before the account lookup on
  POST /login), puter.signin.validate (before the session is created) and
  puter.signin. Listeners can refuse or require phone or card verification; a
  listener that throws is ignored.
- POST /login keeps a wrong-password budget per account across all networks,
  20 an hour and 50 a day. A browser that has signed in to the account before
  is not refused, and the budget belongs to the current password.
- An account unused for dormantSignInDays (default 180) confirms an
  unconfirmed email at sign-in, where the deployment can send mail.
- New account emails: sign-in from a new browser, sign-in attempts blocked,
  password reset completed.
- pwnedPasswords (off by default): a k-anonymity range lookup after a
  successful password sign-in, with a notice to the owner.
- requestSignalHeaders and requestSignalValue turn configured request headers
  into req.requestSignals and a puter.request.flagged event.

Sessions
- web and app sessions end after 180 days without activity; accounts with no
  password and no email keep 365 days. A missing expiry on web, app and asset
  rows no longer means no expiry, and ended rows are purged.
- The cookie a private hosted site sets from ?auth_token= is tied to the
  token's session row and carries a 7-day expiry.

Email confirmation codes
- A 6-digit code is valid for 60 minutes and has a wrong-code budget.

Mailbox ingress
- email.ingress.validate runs before a message is stored; a listener can refuse
  it or record a sender check. X-Puter-Sender-Auth is written by the server
  only. Header blocks over 256 KiB are refused.

GUI
- Login sends the device fingerprint, can show the captcha widget
  (gui_params.turnstileLogin), offers a password reset when sign-in is locked,
  and runs pending verification windows after a popup sign-in or signup.
2026-11-18 23:02:16 -07:00
..