RocketChat / RocketChat/Rocket.Chat

Missing validation for visitor token in livechat:closeByVisitor

Open
#21,074 0 comments 0 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 closing the room by the method livechat:closeByVisitor Rocket.Chat does not check for token validity. That could lead to several situations:

  • Wrong or missing token: The room closer will be set to the first visitor in the db
  • Provide token but the visitor owns that token is not the visitor of the closed room: Room closed successfully.
Steps to reproduce:
  1. Call livechat:closeByVisitor without a visitor token or invalid visitor token
Expected behavior:

An error about invalid visitor token returned

Actual behavior:

Room closed successfully

Server Setup Information:
  • Version of Rocket.Chat Server: 3.12.1
  • Operating System: Linux
  • Deployment Method: All
  • Number of Running Instances: any
  • DB Replicaset Oplog: enabled
  • NodeJS Version: 12.18.4
  • MongoDB Version: 4
Client Setup Information
  • Desktop App or Browser Version: latest
  • Operating System: windows
Additional context

The file located in app/app/livechat/server/methods/closeByVisitor.js

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 with app/app/livechat/server/methods/closeByVisitor.js and reproduce livechat:closeByVisitor using a missing or invalid visitor token. Verify that an invalid token returns an error and that a token belonging to a different visitor cannot close the room; done means the room is not closed in those cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, authentication, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.