Skip to content

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

Merged
solracsf merged 3 commits into
stable33from
backport/64572/stable33
Sep 23, 2026
Merged

solracsf merged 3 commits into
stable33from
backport/64572/stable33

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 33.0.10 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/stable33 branch from 4296fc9 to 98c43d9 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 13:33
@solracsf
solracsf requested a review from a team as a code owner September 22, 2026 13:33
@solracsf
solracsf requested review from come-nc and salmart-dev and removed request for a team September 22, 2026 13:33
This file has no `use OCP\Server;` import here, unlike master, so the
bare `Server::get()` added by the backport resolved to the file's own
namespace and failed psalm with UndefinedClass.

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
@solracsf
solracsf enabled auto-merge September 22, 2026 16:51
@solracsf
solracsf merged commit d7c3c15 into stable33 Sep 23, 2026
163 checks passed
@solracsf
solracsf deleted the backport/64572/stable33 branch September 23, 2026 11:31
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