fix: Session cookie lifetime, renewal, CSRF echo, and current-session… - #117
Merged
Merged
Conversation
m-t-a97
force-pushed
the
fix/session-cookie-and-sign-out-hardening
branch
from
September 13, 2026 18:36
49b95aa to
77db6db
Compare
… GET /me and sign-out Sessions and cookies drifted apart in several places, and both GET /me and POST /sign-out assumed the user's newest session was the current one. A user signed in on two devices could see, or revoke, the wrong session. Session plugin - renew sessions in place instead of delete+create - cap cookie Max-Age to the session lifetime; ClearSessionCookie carries SameSite - warn at startup when UpdateAge >= ExpiresIn - expose the authenticated session id on the request context CSRF plugin - echo X-AUTHULA-CSRF-TOKEN on every safe request - compare tokens in constant time Config - CookieMaxAge defaults to and follows ExpiresIn Core - GET /me returns the session that authenticated the request (GetMe now takes sessionID) - POST /sign-out with no body revokes the caller's own session (cookie or JWT session_id claim); a supplied session_id must belong to the caller (403) and must exist (404); sign_out_all is unchanged - POST /sign-out no longer guesses: with no body and no session id on the request it returns 400 (ErrNoSessionToSignOut) instead of revoking the user's newest session - auth.sign_out (cookie clear) is set only when the caller's own session was revoked, so revoking another session by id keeps the caller signed in - CoreAPI.SignOut signature: (ctx, userID, currentSessionID, requestedSessionID, signOutAll) Admin - restored impersonation cookie carries Max-Age Tests and docs - new handler tests for sign-out, rewritten usecase table, extended session/CSRF/config tests - docs/core/sign-out.md and updated OpenAPI description
m-t-a97
force-pushed
the
fix/session-cookie-and-sign-out-hardening
branch
from
September 13, 2026 19:40
77db6db to
5599601
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… GET /me and sign-out
Sessions and cookies drifted apart in several places, and both GET /me and POST /sign-out assumed the user's newest session was the current one. A user signed in on two devices could see, or revoke, the wrong session.
Session plugin
CSRF plugin
Config
Core
Admin
Tests and docs