Skip to content

fix(Session): Prevent immediate token invalidation#58555

Open
solracsf wants to merge 1 commit intomasterfrom
preventTokenInvalidation
Open

fix(Session): Prevent immediate token invalidation#58555
solracsf wants to merge 1 commit intomasterfrom
preventTokenInvalidation

Conversation

@solracsf
Copy link
Copy Markdown
Member

Summary

This PR addresses issue #56412 where app passwords (device tokens) generated via occ user:auth-tokens:add, or used in SSO/LDAP environments, are unexpectedly and permanently invalidated exactly 5 minutes after creation.

This correctly logs the user out for that specific session without permanently destroying valid tokens generated by admins or used by SSO users. Legitimate password changes or user deletions will still trigger the expected permanent invalidation.

Checklist

@solracsf solracsf added this to the Nextcloud 34 milestone Feb 24, 2026
@solracsf solracsf requested a review from a team as a code owner February 24, 2026 18:32
@solracsf solracsf added the bug label Feb 24, 2026
@solracsf solracsf requested review from ArtificialOwl and icewind1991 and removed request for a team February 24, 2026 18:32
@solracsf solracsf added the 3. to review Waiting for reviews label Feb 24, 2026
@solracsf solracsf requested review from come-nc and sorbaugh February 24, 2026 18:32
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
if ($this->manager->checkPassword($tokenLoginName, $pwd) === false) {
// If the decrypted password is empty or not a valid local password,
// but the user exists and is enabled, we DO NOT permanently invalidate the token.
if (empty($pwd) || $this->manager->get($tokenLoginName) !== null) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this supposed to be && ?
Otherwise any existing user fills the condition so tokens will not get invalidated anymore apart from deleted users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants