Skip to content

[stable35] fix(session): Prevent stale requests from replacing a regenerated session - #66295

Merged
DerDreschner merged 1 commit into
stable35from
backport/65928/stable35
Nov 4, 2026
Merged

DerDreschner merged 1 commit into
stable35from
backport/65928/stable35

Conversation

@backportbot

@backportbot backportbot Bot commented Nov 4, 2026

Copy link
Copy Markdown

Backport of PR #65928

…sion

Regenerating the session id - on login, on unlocking a public share, on a
remember-me login - leaves the requests that are already on their way with
the previous session cookie. PHP starts a session for that id again and
sends it back in a Set-Cookie header, so the id the browser had just stored
is overwritten and everything the regenerating request did is lost. For a
logged-in user who unlocks a password-protected public share this shows up
as a 401 on PROPFIND /public.php/dav/files/<token>/.

Mark the old session as superseded instead of deleting it, and move the
requests that still arrive on it to an empty session. Within a grace period
of 60 seconds they get no session cookie at all, so they can no longer
replace the regenerated id the browser holds. reopen() does the same and
only sends a cookie when the id it was given is gone for good.

Assisted-by: ClaudeCode:claude-opus-5
Signed-off-by: David Dreschner <david.dreschner@nextcloud.com>
@backportbot
backportbot Bot requested a review from a team as a code owner November 4, 2026 14:09
@backportbot
backportbot Bot requested review from ChristophWurst, DerDreschner, icewind1991, salmart-dev and susnux and removed request for a team November 4, 2026 14:09
@backportbot backportbot Bot added bug 3. to review Waiting for reviews AI assisted labels Nov 4, 2026
@backportbot backportbot Bot added this to the Nextcloud 35.0.3 milestone Nov 4, 2026
@DerDreschner
DerDreschner merged commit 457a3e5 into stable35 Nov 4, 2026
166 of 174 checks passed
@DerDreschner
DerDreschner deleted the backport/65928/stable35 branch November 4, 2026 20:11
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically locked because it has been closed for more than 7 days. As we do not monitor merged or closed pull requests, we are locking this pull request to prevent further comments from getting lost in the noise.
If you discovered any issues with this pull request, please open a new issue instead. In case you want to discuss this pull request or have further questions, please use our forum: https://help.nextcloud.com

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants