Skip to content

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

Merged
DerDreschner merged 1 commit into
stable34from
backport/65928/stable34
Nov 5, 2026
Merged

DerDreschner merged 1 commit into
stable34from
backport/65928/stable34

Conversation

@DerDreschner

Copy link
Copy Markdown
Member

Manual backport of #65928

@DerDreschner DerDreschner self-assigned this Nov 4, 2026
@DerDreschner
DerDreschner requested a review from a team as a code owner November 4, 2026 17:32
@DerDreschner
DerDreschner requested review from leftybournes and salmart-dev and removed request for a team November 4, 2026 17:32
@DerDreschner DerDreschner added 3. to review Waiting for reviews AI assisted labels Nov 4, 2026
@DerDreschner
DerDreschner requested review from a team and susnux November 4, 2026 17:33
@DerDreschner DerDreschner added this to the Nextcloud 34.0.6 milestone Nov 4, 2026
…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>
@AndyScherzinger
AndyScherzinger force-pushed the backport/65928/stable34 branch from 883b007 to aefad03 Compare November 4, 2026 22:57
@DerDreschner
DerDreschner merged commit 7f3190a into stable34 Nov 5, 2026
146 of 148 checks passed
@DerDreschner
DerDreschner deleted the backport/65928/stable34 branch November 5, 2026 04:08
@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 13, 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.

3 participants