Skip to content

fix(Session): Prevent immediate token invalidation - #58555

Open
solracsf wants to merge 1 commit into
masterfrom
preventTokenInvalidation
Open

fix(Session): Prevent immediate token invalidation#58555
solracsf wants to merge 1 commit into
masterfrom
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

@solracsfsolracsf added this to the Nextcloud 34 milestone Feb 24, 2026
@solracsf
solracsf requested a review from a team as a code ownerFebruary 24, 2026 18:32
@solracsf
solracsf requested review from ArtificialOwl and icewind1991 and removed request for a teamFebruary 24, 2026 18:32
@solracsfsolracsf added the 3. to review Waiting for reviews label Feb 24, 2026
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.

@nextcloud-botnextcloud-bot mentioned this pull request May 27, 2026
@nextcloud-botnextcloud-bot mentioned this pull request Jun 4, 2026
This was referenced Jun 5, 2026
@susnuxsusnux added the community pull requests from community label Jun 9, 2026
@nextcloud-botnextcloud-bot mentioned this pull request Aug 12, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewWaiting for reviewsbugcommunitypull requests from communityfeature: authentication

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@solracsf@come-nc@joshtrichards@susnux@nextcloud-bot