mirror of
https://github.com/penpot/penpot.git
synced 2026-11-18 08:01:21 +00:00
* 🐛 Invalidate all sessions on password recovery recover-profile validated the recovery token and updated the password, but never deleted the existing server-side sessions in http_session_v2. A previously captured auth-token kept working after the victim "recovered" the account (GHSA-3j2p-qr45-q365, CWE-613). The command now calls session/invalidate-all for the recovered profile. The command already runs with ::db/transaction true, so the delete joins the same transaction as the password UPDATE: both commit or roll back together. There is no current session to preserve — the RPC is unauthenticated — which is the same contract the profile deletion path uses. Tests in rpc_auth_test.clj pin the behavior: the victim's sessions die, other profiles' sessions survive, and a failed recovery is a no-op. Both invalidation tests failed before the fix. AI-assisted-by: inkling-2-small-free * 🐛 Pin recovery-transaction atomicity after review Review of 92a65f544b found the tests pinned the end state but not the rollback guarantee the fix relies on: the session DELETE joins the password UPDATE in one transaction. Add recover-profile-rollback-keeps-password-and-sessions: send-template throws after the update, so the command must fail with password and sessions both untouched. recover-profile-failure-keeps-sessions now also asserts the password, matching its docstring. The invalidate-all docstring mentions the recovery caller. Addresses review findings M1, M2 and M3. AI-assisted-by: inkling-2-small-free * 🔥 Drop recovery test that never reached the fix The failure test used a token with the :authentication issuer, so tokens/verify rejected it before any write. It passed with or without the invalidation fix and exercised no new code. The rollback test already covers that a failed recovery leaves no partial effects. AI-assisted-by: hy4-flash-free