[Bug]: LDAP authentication invalidates existing OIDC sessions by updating passwordless authentication tokens
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 22/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- php
調査の方向性
The suspect is PublicKeyTokenProvider::updatePasswords(), which rewrites existing passwordless tokens when the same user logs in via LDAP. Start by reading how that method selects tokens and why passwordless OIDC tokens match it. Done means an OIDC token keeps a NULL password after an LDAP login, and a regression test covers that case. Expect the token and password-storage logic to need maintainer input.
索引モデルが issue の本文から書いたものです。
説明
⚠️ This issue respects the following points: ⚠️
- This is not a troubleshooting question, general support matter, or webserver/proxy problem, but likely a bug (if unsure, ask the Community Help Forum).
- This issue is not already reported on Github OR solved at the Community Help Forum (I've searched!).
- I'm using a maintained major version of Nextcloud Server and tested against the latest patch level. (Supported major versions and current patch levels).
- I agree to follow Nextcloud's Code of Conduct.
- I've tried my best to provide clear reproduction steps that someone unfamiliar with this bug could use to reproduce it.
Bug description
When LDAP and OIDC authentication coexist for the same Nextcloud user account, OIDC-authenticated web sessions are unexpectedly invalidated after a few minutes.
We traced the issue to the Nextcloud authentication token management mechanism. Specifically, PublicKeyTokenProvider::updatePasswords() updates existing passwordless authentication tokens when the same user authenticates using LDAP credentials.
This also affects tokens explicitly created for passwordless OIDC authentication.
Environment
- Nextcloud Server: 34.0.3.2
- OpenID Connect Login (oidc_login): 3.3.4
- Identity provider: Keycloak
- LDAP backend: OpenLDAP
- Operating system: Ubuntu 24.04
- PHP: 8.3 FPM
- Web server: Apache
- Database: MariaDB 10.11.14
- Redis enabled
- oidc_login_proxy_ldap: true
- auth.storeCryptedPassword: true (default)
Steps to reproduce
- Configure Nextcloud with LDAP and OIDC authentication, using the same LDAP-backed user account.
- Log in using OIDC.
- Inspect the newly created authentication token in the oc_authtoken database table.
- Verify that its password field is NULL.
- Open a separate browser and authenticate using the same user's LDAP username and password.
- Inspect the original OIDC token again.
- Observe that its password field is no longer NULL.
- Continue using the OIDC session for a few minutes.
- The OIDC session is invalidated, and its authentication token disappears from the database.
The Keycloak SSO session remains active throughout this process.
The web session token retained its original scope:
{"filesystem":true,"password-unconfirmable":true}
After the unexpected logout, the web session token was no longer present in the database.
Expected behavior
Expected behavior
Passwordless authentication tokens should remain passwordless when the same user authenticates through another authentication mechanism.
LDAP authentication should not invalidate existing OIDC sessions or alter their authentication semantics.
Actual behavior
LDAP authentication causes existing OIDC authentication tokens to acquire an encrypted password.
The affected web sessions are subsequently invalidated.
Nextcloud Server version
34
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.3
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
Upgraded to a MAJOR version (ex. 31 to 32)
Are you using the Nextcloud Server Encryption module?
No response
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
{
"system": {
"instanceid": "***REMOVED SENSITIVE VALUE***",
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"cloud.guifi.net",
"test.cloud.guifi.net",
"192.168.69.11",
"192.168.69.8",
"185.32.16.41",
"185.32.16.42"
],
"auth.webauthn.enabled": false,
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"dbtype": "mysql",
"version": "34.0.3.2",
"overwrite.cli.url": "https:\/\/cloud.guifi.net",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "",
"dbtableprefix": "oc_",
"mysql.utf8mb4": true,
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"installed": true,
"ldapIgnoreNamingRules": false,
"ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory",
"mail_smtpmode": "smtp",
"mail_sendmailmode": "smtp",
"mail_from_address": "***REMOVED SENSITIVE VALUE***",
"mail_domain": "***REMOVED SENSITIVE VALUE***",
"mail_smtphost": "***REMOVED SENSITIVE VALUE***",
"mail_smtpauthtype": "LOGIN",
"mail_smtpport": "465",
"app_install_overwrite": {
"0": "gpxedit",
"1": "ownpad",
"2": "emlviewer",
"3": "whiteboard",
"4": "files_trackdownloads",
"5": "files_bpm",
"7": "talk_simple_poll",
"8": "workflow_media_converter",
"9": "libresign"
},
"memcache.distributed": "\\OC\\Memcache\\Redis",
"memcache.local": "\\OC\\Memcache\\APCu",
"memcache.locking": "\\OC\\Memcache\\Redis",
"redis": {
"host": "***REMOVED SENSITIVE VALUE***",
"port": 0,
"dbindex": 0,
"password": "***REMOVED SENSITIVE VALUE***",
"timeout": 1.5
},
"maintenance": false,
"theme": "",
"loglevel": 2,
"default_phone_region": "ES",
"updater.release.channel": "stable",
"trusted_proxies": "***REMOVED SENSITIVE VALUE***",
"templatedirectory": "\/var\/www\/nextcloud\/data\/appdata_oca0fxkqhitf\/richdocuments\/templates",
"lost_password_link": "https:\/\/identitats.guifi.net\/auth\/realms\/master\/login-actions\/reset-credentials",
"allow_user_to_change_display_name": false,
"oidc_login_provider_url": "https:\/\/identitats.guifi.net\/auth\/realms\/guifiIdM",
"oidc_login_client_id": "cloud",
"oidc_login_client_secret": "5dfe89a9-9642-4497-aa6d-d57b7ef820a9",
"oidc_login_auto_redirect": false,
"oidc_login_end_session_redirect": true,
"oidc_login_logout_url": "https:\/\/cloud.guifi.net\/apps\/oidc_login\/oidc",
"oidc_login_default_quota": "1000000000",
"oidc_login_button_text": "guifi\u00b7net IdM SSO",
"oidc_login_hide_password_form": false,
"hide_login_form": true,
"oidc_login_use_id_token": false,
"oidc_login_attributes": {
"id": "sub",
"name": "name",
"mail": "email",
"home": "homeDirectory",
"ldap_uid": "uid",
"login_filter": "realm_access_roles",
"photoURL": "picture",
"groups": "guifiIdMGroups"
},
"oidc_create_groups": true,
"oidc_login_use_external_storage": false,
"oidc_login_scope": "openid profile",
"oidc_login_proxy_ldap": true,
"oidc_login_disable_registration": true,
"oidc_login_redir_fallback": true,
"oidc_login_alt_login_page": false,
"oidc_login_tls_verify": true,
"oidc_login_webdav_enabled": false,
"oidc_login_password_authentication": true,
"oidc_login_public_key_caching_time": 86400,
"oidc_login_min_time_between_jwks_requests": 10,
"oidc_login_well_known_caching_time": 86400,
"oidc_login_update_avatar": false,
"oidc_login_skip_proxy": false,
"oidc_login_code_challenge_method": "",
"session_lifetime": 36000,
"maintenance_window_start": 1,
"has_internet_connection": true,
"mail_smtpstreamoptions": {
"ssl": {
"allow_self_signed": false,
"verify_peer": true,
"verify_peer_name": true
}
},
"mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
"mail_smtpname": "***REMOVED SENSITIVE VALUE***",
"mail_smtpauth": true,
"mail_smtpdebug": false,
"mail_smtpsecure": "ssl",
"auth.storeCryptedPassword": false
}
}
List of activated Apps
Enabled:
- activity: 7.0.0
- admin_audit: 1.24.0
- analytics: 7.2.0
- announcementcenter: 7.5.1
- app_api: 34.0.0
- appstore: 1.0.0
- bookmarks: 16.2.7
- bruteforcesettings: 7.0.0
- calendar: 6.6.5
- circles: 34.0.0
- cloud_federation_api: 1.18.0
- collectives: 4.8.0
- comments: 1.24.0
- contacts: 8.9.5
- contactsinteraction: 1.15.0
- context_chat: 5.5.0
- dashboard: 7.14.0
- dav: 1.40.0
- deck: 1.18.6
- drawio: 4.3.11
- event_update_notification: 2.10.0
- external: 9.0.1
- federatedfilesharing: 1.24.0
- federation: 1.24.0
- files: 2.6.0
- files_downloadlimit: 5.2.0
- files_external: 1.26.0
- files_fulltextsearch: 34.0.2
- files_linkeditor: 1.1.27
- files_lock: 34.0.1
- files_mindmap: 0.1.5
- files_pdfviewer: 7.0.0-dev.0
- files_reminders: 1.7.0
- files_sharing: 1.26.0
- files_trashbin: 1.24.0
- files_versions: 1.27.0
- fileslibreofficeedit: 3.0.0
- firstrunwizard: 7.0.0-dev.0
- forms: 5.4.1
- fulltextsearch: 34.0.3
- fulltextsearch_elasticsearch: 34.0.3
- gpxpod: 8.5.0
- group_everyone: 0.1.21
- groupfolders: 22.0.6
- impersonate: 5.0.0
- integration_gitlab: 5.0.0
- integration_matrix: 1.2.0
- integration_openai: 4.5.2
- integration_openproject: 3.3.0
- integration_zammad: 4.2.0
- logreader: 7.0.0
- lookup_server_connector: 1.22.0
- mail: 5.13.1
- nextcloud_announcements: 6.0.0
- notes: 6.1.0
- notifications: 7.0.0-dev.1
- notify_push: 1.4.2
- oauth2: 1.22.0
- office: 1.0.0
- oidc_login: 3.3.4
- password_policy: 6.0.0-dev.0
- passwords: 2026.11.10
- photos: 7.0.0
- polls: 9.3.0
- privacy: 6.0.0-dev.1
- profile: 1.3.0
- provisioning_api: 1.24.0
- recommendations: 7.0.0
- related_resources: 5.0.0-dev.0
- richdocuments: 11.1.2
- richdocumentscode: 26.4.502
- serverinfo: 6.0.0
- settings: 1.17.0
- sharebymail: 1.24.0
- side_menu: 6.2.0
- spreed: 24.0.7
- support: 6.0.0
- survey_client: 6.0.0-dev.0
- systemtags: 1.24.0
- tasks: 0.18.1
- text: 8.0.0
- theming: 2.9.0
- theming_customcss: 1.22.0
- timemanager: 0.3.27
- twofactor_backupcodes: 1.23.0
- twofactor_totp: 16.0.0
- updatenotification: 1.24.0
- user_ldap: 1.25.0
- user_status: 1.14.0
- viewer: 7.0.0-dev.0
- weather_status: 1.14.0
- webhook_listeners: 1.6.0
- whiteboard: 2.1.2
- workflow_media_converter: 3.2.2
- workflowengine: 2.16.0
Disabled:
- apporder: 0.15.0 (installed 0.15.0)
- bbb: 2.9.3 (installed 2.9.3)
- emlviewer: 2.0.3 (installed 2.0.3)
- encryption: 2.22.0
- files_bpm: 1.8.3 (installed 1.8.3)
- files_downloadactivity: 1.18.1 (installed 1.18.1)
- files_rightclick: 0.15.1 (installed 1.6.0)
- files_trackdownloads: 1.11.0 (installed 1.11.0)
- gpxedit: 0.0.14 (installed 0.0.14)
- integration_mastodon: 5.2.0 (installed 5.2.0)
- ldap_contacts_backend: 1.14.0 (installed 1.14.0)
- ldap_write_support: 1.16.0 (installed 1.16.0)
- libresign: 14.1.0 (installed 14.1.0)
- listman: 33.0.1 (installed 33.0.1)
- onlyoffice: 10.1.2 (installed 10.1.2)
- ownpad: 0.13.2 (installed 0.13.2)
- rainloop: 7.2.6 (installed 7.2.6)
- registration: 3.0.0 (installed 3.0.0)
- riotchat: 0.21.0 (installed 0.21.0)
- sociallogin: 6.5.4 (installed 6.5.4)
- suspicious_login: 12.0.0-dev.0
- talk_simple_poll: 1.3.1 (installed 1.3.1)
- timetracker: 0.0.87 (installed 0.0.87)
- twofactor_nextcloud_notification: 8.0.0
- user_oidc: 8.10.1 (installed 8.10.1)
- user_saml: 8.3.0 (installed 8.3.0)
- workflow_pdf_converter: 5.0.0 (installed 5.0.0)
Nextcloud Signing status
Nextcloud Logs
Relevant log messages
Login failed: '<LDAP_UUID>'
Session token credentials are invalid
These messages occur during ordinary authenticated requests, including the user status heartbeat.
Additional info
Verified workaround
Setting the following configuration option prevents the observed issue:
'auth.storeCryptedPassword' => false,
After applying this configuration, OIDC sessions remained active for more than one hour, whereas they had previously been repeatedly invalidated within minutes.
However, this is a global workaround with implications for password-dependent functionality and session revocation after password changes.
Suggested resolution
Preserve the passwordless nature of tokens issued through external authentication mechanisms when updating credentials associated with password-based tokens.
The distinction should ideally also apply to application tokens derived from passwordless sessions.
Potentially related issue
https://github.com/nextcloud/user_oidc/issues/1552
Although that report involves a different OIDC application and identity provider, it describes very similar symptoms, suggesting that the underlying issue may be in Nextcloud Server rather than in a specific OIDC implementation.
- 主要言語
- PHP
- スター
- 37.6k
- フォーク
- 5.4k
- 平均マージ
- 1日 13時間
- マージ済み PR(30日)
- 623
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nextcloud/server のほかの issue
-
0. Needs triage 35-feedback bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
34-feedback
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
[Bug]: GET /js/../<anything> returns 500 (NotPermittedException from JsController::getJs) instead of 404対応中かも @lazerg が 7 日前に担当しました。 オープン35-feedback
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
[Bug]: Dashboard widgets registered via OCA.Dashboard.register() sometimes never mount (spinner forever) – Vue 3 non-deep `callbacks` watcher race対応中かも @lazerg が 7 日前に担当しました。 オープン35-feedback
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
nextcloud/server の issue をすべて見る
似ている issue
-
area: tests area: user refactoring
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
nplhse/collaborative-ivena-statistics#1845 ·
メンテナーはふだん 1 日以内に返信
-
[Sync EN] filesystem: document the ValueError of fgets(), file_get_contents(), and touch() (#6167)オープンsync-en
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
sync-en
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 2 日以内に返信
-
Перевод устарел
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信
-
Documentation Feature: Events / Calendar
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信