Conversation
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. createRememberMeToken() now marks the current session token as remembered. 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
requested review from
Altahrim,
come-nc,
icewind1991 and
provokateurin
and removed request for
a team
September 19, 2026 18:24
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
icewind1991
reviewed
Sep 21, 2026
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
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. Fix it where the mismatch originates and drop the workaround in createRememberMeToken(). Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
…le-session-token Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
…le-session-token Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Since 33.0.9 a stale remember-me cookie logs "Could not find the session token to renew" on every request, so affected instances end up with thousands of these. The cookie points at a session token that no longer exists. This fixes two ways that happens in core:
OC_User::loginWithApache()creates the session token as "do not remember" but then sets the 15 day remember-me cookies. The cleanup job deletes such tokens aftersession_lifetime(24h by default), so anyone away for a day hits the loop when they come back. The token is now created asREMEMBER.regenerateId(true, true)(password protected share unlock, Talk password rooms) moves the token to the new session id but never updatednc_session_id. The cookie is now rewritten to the new id.What is not covered:
user_oidchas the same mismatch as the Apache login (it creates the token with the defaultDO_NOT_REMEMBERand then callscreateRememberMeToken()), so it needs the same one line change in that app. A token that is revoked or logged out via IdP backchannel logout after the browser session already expired still leaves the cookies behind, and each request will still log the error. Tokens that are already orphaned are not repaired, those users have to log in once more.Tested in Docker (sqlite): the new unit tests fail without the change and pass with it.
tests/lib/Userpasses. I also checked both fixes against a live instance: the share unlock keeps cookie login working (before the change it returned 401 and logged the error), and a session created throughloginWithApache()now getsremember=1instead of0. There is no unit test forloginWithApache(), since it needs a real PHP session.Needs backports to stable33 (where 33.0.9 introduced the log flood) and probably stable34.
Checklist
3. to review, feature component)stable32)AI (if applicable)