RocketChat / RocketChat/Rocket.Chat

Incorrect CORS Policy

Open
#24,001 1 comment 2 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:

Currently, there are some problems with the Cors Policy that I can see:

  • Cors is only applied for the OPTIONS method
  • Cors is not applied for resources
  • Cors is not applied for GET request
  • Cors is not applied for Apps Endpoints
  • Cors is not applied for Websocket

Even if the current Cors policy can protect the user in most cases, but if we don't strictly follow the best practice, the vulnerabilities can be exploited in a way we cannot expect.

Steps to reproduce:
Expected behavior:

Cors policy is applied to all requests to the Rocket.Chat server

Actual behavior:

Cors policy is only applied to OPTIONS request of Rest API

Server Setup Information:
  • Version of Rocket.Chat Server: latest
  • Operating System: all
  • Deployment Method: all
  • Number of Running Instances: all
  • DB Replicaset Oplog: all
  • NodeJS Version: all
  • MongoDB Version:all
Client Setup Information
  • Desktop App or Browser Version:
  • Operating System:
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 tracing how CORS is handled for the request categories named in the issue: OPTIONS, GET, other REST requests, resources, Apps Endpoints, and Websocket connections. Verify each category and consider the work done when the CORS policy is applied consistently to all requests to the Rocket.Chat server.

Written by the indexing model from the issue text.

Assessment

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