Replace the count of logouts with a random value (part of #256)
check / check (push) Waiting to run

The session manager now keeps a random value from crypto/rand in the
logout table, made when the table has none and replaced by each logout.
A session carries the value current at its login and is refused when it
differs. A lost state directory now ends every login session, and no
logout can make an ended one work again, as a count starting from 0
could. README.md and the Manager doc comment say the check for a logout
compares no time, while a session's expiry still compares the clock.

Model: opus-5-5
This commit is contained in:
2026-10-15 17:00:58 +00:00
parent fd4517c6d9
commit f63ebf57ba
5 changed files with 82 additions and 66 deletions
+2 -2
View File
@@ -164,8 +164,8 @@ func (s *Handlers) initImageService() error {
// Initialize session manager (signing key is validated at config load
// time). Session cookies are always Secure/HttpOnly/SameSite=Strict.
// The count of logouts is saved in the database, so it outlasts a
// restart.
// The random value that each logout replaces is saved in the database,
// so it outlasts a restart.
sessMgr, err := session.NewManagerWithDatabase(
context.Background(), s.config.SigningKey, s.db.DB())
if err != nil {