RocketChat / RocketChat/Rocket.Chat

Custom OAuth token redirect URL is wrong

Open
#22,302 1 comment 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:

The custom OAuth config gives incorrect redirect url in the /token call. I'm using docker behind nginx, and the redirect url given is the the docker url directly, like: http://mydomain.com:3000/_oauth/myidp istead of correct https://mydomain.com:/_oauth/myidp.

The admin panel shows correct https URL though.

It works otherwise, I had to relax the checks in my IdP to get pass that URL issue. That is however bad security!

Steps to reproduce:
  1. Configure a custom OAuth service in tha admin panel against some flexible IdP.
    (Sorry I cannot share what I'm using, its in-house IdP).
  2. Do the auth until you get to /token phase. See the redirect URL in incorrect.
Expected behavior:

Redirect URL should match the one in Admin panel.

Actual behavior:

URL matches the proxy_pass config in NGINX.

Server Setup Information:
  • Version of Rocket.Chat Server: 3.15.0 from docker:latest
  • Operating System: Ubuntu 20.04
  • Deployment Method: docker
  • Number of Running Instances: 1
Client Setup Information

Firefox on Windows 10

Additional context

Is there any config flag to force the URL?

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 the custom OAuth configuration and /token flow, comparing the redirect URL shown in the admin panel with the URL produced behind the NGINX proxy_pass setup. Reproduce with a custom IdP or equivalent proxied HTTPS configuration; done means the token request uses the configured public HTTPS redirect URL rather than the Docker URL, with coverage for the proxied case.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, nginx, 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.