RocketChat / RocketChat/Rocket.Chat
Inconsistent return type in parseUriList leads to incorrect OAuth redirectUri handling
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description
What: parseUriList(userUri) returns a string instead of a consistent array type.
Where: parseUriList.ts (used by updateOAuthApp and addOAuthApp)
Problem:
Callers expect an array-like redirectUri (e.g., checking .length, storing in DB). Returning a string may pass some checks but leads to incorrect runtime behavior and inconsistent DB schema (string vs array).
Steps to Reproduce
- Call
parseUriList('https://example.com')→ returns a string - Call
parseUriList('https://a.com,https://b.com')→ returns a comma-separated string - Observe incorrect handling in OAuth flows
Impact
- Subtle runtime bugs
- Inconsistent database entries
- Issues in OAuth redirect validation
Expected Behavior
parseUriList should always return string[]:
- Empty input →
[] - Single URI →
['uri'] - Multiple URIs →
['uri1', 'uri2']
Possible Solution
Update parseUriList to always return an array of trimmed URIs.
Add unit tests for empty, single, and multiple inputs.
(Optional) Migrate existing string values in DB to arrays.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in parseUriList.ts and trace its use from updateOAuthApp and addOAuthApp. Verify the current behavior for empty, single, and comma-separated URI inputs, then add unit tests covering those cases. Done means parseUriList consistently returns trimmed string arrays and the OAuth callers handle redirectUri with that shape.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, authentication
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100