RocketChat / RocketChat/Rocket.Chat

LDAP-users are getting deactivated.

Open
#31,212 1 comment 1 reaction 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:

Since we updated to rocketchat 6.5.0 ldap users can't login anymore. Running sessions are fine,
but if one user is trying to log on the account gets deactivated.

Steps to reproduce:
  1. Update from x.x to 6.5.0
  2. switch to community version
    3.try to login with a LDAP user
Expected behavior:

get a session

Actual behavior:

"Before you can login, your account must be manually activated by an administrator."

On the admin panel NO user is shown. There is a an error message:

"PlanExecutor error during aggregation :: caused by :: can't convert from BSON type array to String"

grafik

Server Setup Information:
  • Version of Rocket.Chat Server: 6.5.0
  • OS: Ubuntu 22.04 LTS
  • Deployment Method: snap
  • Version der Anwendungs-Engine 1.41.0
  • Node-Version v14.21.2
  • MongoDB 5.0.15 / wiredTiger (oplog Aktiviert)
Client Setup Information
  • Browser Version: Firefox and chrome
Additional context

ldap connection

Relevant logs:

{"level":35,"time":"2023-12-12T11:44:33.897Z","pid":1628,"hostname":"chat","name":"API","method":"GET","url":"/api/v1/users.list?count=25&fields=%7B%22name%22%3A1%2C%22username%22%3A1%2C%22emails%22%3A1%2C%22roles%22%3A1%2C%22status%22%3A1%2C%22avatarETag%22%3A1%2C%22active%22%3A1%7D&offset=0&query=%7B%22%24or%22%3A%5B%7B%22emails.address%22%3A%7B%22%24regex%22%3A%22%22%2C%22%24options%22%3A%22i%22%7D%7D%2C%7B%22username%22%3A%7B%22%24regex%22%3A%22%22%2C%22%24options%22%3A%22i%22%7D%7D%2C%7B%22name%22%3A%7B%22%24regex%22%3A%22%22%2C%22%24options%22%3A%22i%22%7D%7D%5D%7D&sort=%7B%20%22name%22%3A%201%20%7D","userId":"vqGa7BftEP5Ao4jRY","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0","host":"mati.hki-jena.de:3000","referer":"https://chat.hki-jena.de/admin/users","remoteIP":"10.16.14.234","err":{"type":"MongoServerError","message":"PlanExecutor error during aggregation :: caused by :: can't convert from BSON type array to String","stack":"MongoServerError: PlanExecutor error during aggregation :: caused by :: can't convert from BSON type array to String
at Connection.onMessage (/snap/rocketchat-server/1597/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/connection.js:231:30)
at MessageStream. (/snap/rocketchat-server/1597/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/connection.js:61:60)
at MessageStream.emit (events.js:400:28)
at MessageStream.emit (domain.js:475:12)
at processIncomingData (/snap/rocketchat-server/1597/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/message_stream.js:125:16)
at MessageStream._write (/snap/rocketchat-server/1597/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/message_stream.js:33:9)
at writeOrBuffer (internal/streams/writable.js:358:12)
at MessageStream.Writable.write (internal/streams/writable.js:303:10)
at Socket.ondata (internal/streams/readable.js:731:22)
at Socket.emit (events.js:400:28)
at Socket.emit (domain.js:475:12)
at addChunk (internal/streams/readable.js:293:12)
at readableAddChunk (internal/streams/readable.js:267:9)
at Socket.Readable.push (internal/streams/readable.js:206:10)
at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
at TCP.callbackTrampoline (internal/async_hooks.js:130:17)
=> awaited here:
at Function.Promise.await (/snap/rocketchat-server/1597/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)
at app/api/server/v1/users.ts:511:16
at /snap/rocketchat-server/1597/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40
=> awaited here:
at Function.Promise.await (/snap/rocketchat-server/1597/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)
at packages/meteor.js:367:22
at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1389:31)
at app/api/server/api.ts:635:39
at /snap/rocketchat-server/1597/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40","ok":0,"code":16007,"codeName":"Location1600

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 in app/api/server/v1/users.ts around line 511 and reproduce the users.list request from the log while reviewing the LDAP login flow. Trace the aggregation error involving an array converted to a string and verify the affected user data shape. Done means LDAP users can log in and the admin users list no longer fails with the MongoDB error.

Written by the indexing model from the issue text.

Assessment

Tech stack
mongodb, typescript
Domain
api, authentication, databases
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.