Skip to content

[stable35] fix(auth): keep remember-me cookies pointing at a live session token - #64649

Merged
kesselb merged 2 commits into
stable35from
backport/64572/stable35
Sep 29, 2026
Merged

kesselb merged 2 commits into
stable35from
backport/64572/stable35

Conversation

@backportbot

@backportbot backportbot Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Backport of #64572

Todo

  • Review and resolve any conflicts
  • Review and verify the backported changes
  • Amend HEAD commit to remove the line stating to skip CI

Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

@backportbot backportbot Bot added the 3. to review Waiting for reviews label Sep 22, 2026
@backportbot backportbot Bot added this to the Nextcloud 35.0.1 milestone Sep 22, 2026
@solracsf solracsf closed this Sep 22, 2026
@solracsf solracsf reopened this Sep 22, 2026
@solracsf
solracsf force-pushed the backport/64572/stable35 branch from c624649 to 185cc0e Compare September 22, 2026 13:27
@solracsf
solracsf marked this pull request as ready for review September 22, 2026 14:46
@solracsf
solracsf requested a review from a team as a code owner September 22, 2026 14:46
@solracsf
solracsf requested review from CarlSchwan and come-nc and removed request for a team September 22, 2026 14:46
fix(auth): keep remember-me cookies pointing at a live session token

The remember-me cookie outlives the session token it refers to in two

cases, and cookie login then fails on every request.

A session token created as DO_NOT_REMEMBER (user_oidc, Apache login) is

removed by the cleanup job after session_lifetime, while the cookies last

remember_login_cookie_lifetime. loginWithApache() now creates its token

as REMEMBER, and createRememberMeToken() marks a DO_NOT_REMEMBER token

as REMEMBER for other callers with the same mismatch.

ISession::regenerateId(true, true) moves the token to the new session id

but left nc_session_id pointing at the old one (password protected share

unlock, Talk password rooms). The cookie is now rewritten with the new id.

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
loginWithApache() sets remember-me cookies but created the session token
as DO_NOT_REMEMBER, so the cleanup job removed it after session_lifetime
while the cookie stayed valid, matching the mismatch fixed for the
share-unlock case in the previous commit.

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
@kesselb
kesselb force-pushed the backport/64572/stable35 branch from 61e4c6c to 501f24c Compare September 29, 2026 08:14
@kesselb
kesselb merged commit 43c37c4 into stable35 Sep 29, 2026
154 checks passed
@kesselb
kesselb deleted the backport/64572/stable35 branch September 29, 2026 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants