RocketChat / RocketChat/Rocket.Chat

[6.3.0] - LDAP login not working for (some) existing users

Open
#30,034 23 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

Description:

When existing users log in via LDAP, some users fail to log in w/o any notification.

Steps to reproduce:
  1. Configure LDAP Login
  2. Login as a LDAP user and log out
  3. log back in
Expected behavior:

Login should work

Actual behavior:

Login does not work. Wrong passwords show a notification, but the correct password shows no message at all in the GUI. The log shows the following entry:

{"level":50,"time":"2023-08-04T14:30:35.899Z","pid":1882221,"hostname":"rocketchat","name":"LDAP Data Converter","err":{"type":"errorClass","message":"Username already exists. [403]","stack":"Error: Username already exists. [403]<br>    at AccountsServer.insertUserDoc (packages/accounts-base/accounts_server.js:1206:15)<br>    at app/authentication/server/startup/index.js:300:28<br>    at /opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40<br> => awaited here:<br>    at Function.Promise.await (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)<br>    at AccountsServer.Accounts.insertUserDoc (app/authentication/server/startup/index.js:355:17)<br>    at app/importer/server/classes/ImportDataConverter.ts:372:19<br>    at /opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40<br> => awaited here:<br>    at Function.Promise.await (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)<br>    at app/importer/server/classes/ImportDataConverter.ts:523:18<br>    at /opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40","isClientSafe":true,"error":403,"reason":"Username already exists.","errorType":"Meteor.Error"},"msg":"Username already exists. [403]"} 

Interestingly, the setting to merge existing users is already set to on.

Server Setup Information:
  • Version of Rocket.Chat Server: 6.3.0
  • Operating System: Debian 11
  • Deployment Method: tar
  • Number of Running Instances: 1
  • DB Replicaset Oplog: 1
  • NodeJS Version: v14.21.3
  • MongoDB Version: 5.0.19
Client Setup Information
  • Desktop App or Browser Version: Browser/Firefox
  • Operating System: Any
Additional context
Relevant logs:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the LDAP login flow and read app/authentication/server/startup/index.js, packages/accounts-base/accounts_server.js, and app/importer/server/classes/ImportDataConverter.ts around the logged error. Trace how the existing-user merge setting is applied; done means existing LDAP users can log in successfully while incorrect passwords still show the expected notification.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
authentication, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.