Skip to content

Regenerate the session id on login - #5

Merged
daedeloth merged 1 commit into
masterfrom
fix/regenerate-session-on-login
Oct 7, 2026
Merged

daedeloth merged 1 commit into
masterfrom
fix/regenerate-session-on-login

Conversation

@daedeloth

Copy link
Copy Markdown
Member

What changes

Module::login() gives the session a new id right before the user id is stored in it. The stored session of the old id is removed.

  • The session data is kept, so the post-login redirect still works. The authorization state has already been checked and removed by BasicFlow at that point.
  • It calls Session::regenerate() when the installed Neuron has that method (added in Sessions: validate ids, opt-in query parameter, expiry, regenerate() Neuron#14). On older Neuron versions it calls session_regenerate_id(true) itself, when a session is active and the session cookie can still be sent. The catlabinteractive/neuron constraint (>=3.0.0) is unchanged.
  • Without an active session nothing happens.

Compatibility

No API change. After login the browser receives a new session cookie; code that kept the pre-login session id somewhere else will no longer find that session.

Tests

tests/ModuleTest.php: the id is regenerated once, before the identity is stored, and the return URL survives; a login without an active session does not start one.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DqZUi2UiBJP6rZoCSRcdpE

Module::login () gives the session a new id right before the user id is
stored. The session data (post-login redirect) is kept.

Uses Session::regenerate () where the installed Neuron has it, and
session_regenerate_id (true) on an active session otherwise, so the
Neuron constraint (>=3.0.0) does not change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DqZUi2UiBJP6rZoCSRcdpE
@daedeloth
daedeloth merged commit ef07459 into master Oct 7, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant