RocketChat / RocketChat/Rocket.Chat

users.createToken does not respect OTP required for admin Personal Access Tokens

Open
#20,626 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:

If I call the api 'users.createToken' with headers={"X-User-Id": admUserId, "X-Auth-Token": some_personal_access_token_with_otp_required} , json= {"username": userToDisable}) , the access token for the user is created BUT it shouldn't. The call should fail because my personal access token requires OTP.

Steps to reproduce:
  1. Create a personal access token for some admin user and set OTP as required ( default )
  2. Try to create a token for another user using the admin personal token
  3. the operation will be sucessful
Expected behavior:

It should fail due missing OTP.

Actual behavior:

The token for the user will be created.

Server Setup Information:
  • Version of Rocket.Chat Server: 3.11
  • Operating System: k8s
  • Deployment Method: k8s
  • Number of Running Instances: 1
  • DB Replicaset Oplog:
  • NodeJS Version:
  • MongoDB Version: 4.0.20
Client Setup Information
  • Desktop App or Browser Version: N/A
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 at the users.createToken API entry point and reproduce the request with an admin personal access token that requires OTP. Done means the operation rejects the request when OTP is missing instead of creating the other user's token.

Written by the indexing model from the issue text.

Assessment

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