Skip to content

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

Merged
solracsf merged 2 commits into
stable34from
backport/64572/stable34
Sep 23, 2026
Merged

solracsf merged 2 commits into
stable34from
backport/64572/stable34

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 34.0.5 milestone Sep 22, 2026
@solracsf solracsf closed this Sep 22, 2026
@solracsf solracsf reopened this Sep 22, 2026
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>
@solracsf
solracsf force-pushed the backport/64572/stable34 branch from dd5e049 to 38b6479 Compare September 22, 2026 13:27
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>
@solracsf
solracsf marked this pull request as ready for review September 22, 2026 14:22
@solracsf
solracsf requested a review from a team as a code owner September 22, 2026 14:22
@solracsf
solracsf requested review from come-nc and leftybournes and removed request for a team September 22, 2026 14:22
@solracsf
solracsf enabled auto-merge September 22, 2026 16:51
@solracsf
solracsf merged commit 6df5894 into stable34 Sep 23, 2026
153 checks passed
@solracsf
solracsf deleted the backport/64572/stable34 branch September 23, 2026 11:30
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.

2 participants