Changing the password neither regenerates the current session nor invalidates any other one #278
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Two halves of the same gap, found independently by two lanes of the 2026-08-24 audit.
The current session is not regenerated. Found during the review of #276: the password-change flow writes no session cookie at all (
internal/handlers/profile.goonly reads). Login DOES regenerate —session.Regenerateis called there, which is what closed #38 — so the mechanism exists and this path simply does not use it.No other session is invalidated. Found by the security lane, verified by execution: with two live sessions, changing the password through the UI succeeded (new password logs in
303, old password401with no cookie issued) and the OTHER session's cookie still returned200afterwards. The store isgorilla/sessionsCookieStore, which is stateless, so nothing server-side tracks or revokes a session.Why it matters together: changing a password is what an operator does when they believe a credential is exposed. Today that action does not end the exposure. A captured cookie stays valid to the 24 h idle / 7-day absolute bound, and the only remediation available is deleting
session_keyfromsettingsand restarting — which is not documented anywhere.Not milestoned: single-operator, self-hosted, and the attacker needs a stolen cookie to begin with. But it is the wrong behaviour for the one action whose entire purpose is revoking access.
Definition of done
CookieStoreis stateless, so it needs either server-side session tracking or a value mixed into the cookie's signing/validation that changes on password change (a per-user token bumped on change is the usual shape and requires no session table). Choose deliberately, state the choice and its cost in the PR body, and note that rotating the globalsession_keyis NOT acceptable — it would log out every user and break sessions on unrelated changes.Verification
make checkgreen.