RocketChat / RocketChat/Rocket.Chat

CAS popup login can hang forever if the popup does not close

Open
#40,153 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

Description

The CAS login popup flow can hang indefinitely because openCASLoginPopup() waits only for the popup window to close.

If the CAS callback page does not auto-close the window for any reason, the promise returned by openCASLoginPopup() never resolves. That leaves the login flow stuck with no timeout, retry path, or alternate completion signal.

Why this matters

This is a reliability issue for any deployment using CAS, especially when:

  • the CAS callback page is customized,
  • the popup-close script is blocked by a CSP or browser extension,
  • the user reaches an error page that never closes itself,
  • or the popup stays open after a successful auth redirect.

In those cases, the UI waits forever even though the user has already completed the auth step or cannot complete it anymore.

Code path

apps/meteor/client/lib/openCASLoginPopup.ts

The current implementation polls popup.closed every 100ms and resolves only when the popup closes:

  • waitForPopupClose() keeps a polling interval running
  • openCASLoginPopup() awaits that promise with no timeout
  • there is no postMessage/callback-based success signal
Expected behavior

The login flow should finish or fail in a bounded amount of time, even if the popup does not close itself.

Actual behavior

The flow can hang forever and force the user to refresh or restart the login attempt.

Suggested fix

Consider one of these:

  • add a timeout with a clear fallback error message,
  • resolve the flow from a success callback/postMessage from the popup,
  • or support both popup-close polling and an explicit completion signal.
Environment

Observed in the CAS popup flow in the web client code path.

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 apps/meteor/client/lib/openCASLoginPopup.ts by reading waitForPopupClose() and openCASLoginPopup(), then trace the CAS popup flow and any existing tests or completion signals. Done means the login promise cannot remain pending indefinitely and the flow finishes or fails with a clear bounded outcome.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
authentication, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.