[PR #5729] fix: prevent open redirect in desktop auth callback (CWE-601) #5330

Open
opened 2026-03-17 02:47:10 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/5729
Author: @rajnishprecogs
Created: 12/26/2025
Status: 🔄 Open

Base: mainHead: fix/open-redirect-desktop-callback


📝 Commits (1)

  • 478433e fix: prevent open redirect in desktop auth callback (CWE-601)

📊 Changes

1 file changed (+20 additions, -1 deletions)

View changed files

📝 packages/hoppscotch-backend/src/auth/auth.controller.ts (+20 -1)

📄 Description

Closes #

What's changed

Notes to reviewers


Summary by cubic

Prevents open redirects in the desktop auth callback by parsing redirect_uri and strictly limiting allowed hosts to loopback. Blocks malicious URLs like http://localhost.evil.com.

  • Bug Fixes
    • Use URL parsing instead of a startsWith check.
    • Allow only http scheme and hosts: localhost, 127.0.0.1, [::1]; otherwise return 400.

Written for commit 478433e10b. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/5729 **Author:** [@rajnishprecogs](https://github.com/rajnishprecogs) **Created:** 12/26/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/open-redirect-desktop-callback` --- ### 📝 Commits (1) - [`478433e`](https://github.com/hoppscotch/hoppscotch/commit/478433e10b4c30c22a81834ac3f9ea1f355865ef) fix: prevent open redirect in desktop auth callback (CWE-601) ### 📊 Changes **1 file changed** (+20 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-backend/src/auth/auth.controller.ts` (+20 -1) </details> ### 📄 Description <!-- Thanks for creating this pull request 🤗 Please make sure that the pull request is limited to one type (docs, feature, etc.) and keep it as small as possible. You can open multiple prs instead of opening a huge one. --> <!-- If this pull request closes an issue, please mention the issue number below --> Closes # <!-- Issue # here --> <!-- Add an introduction into what this PR tries to solve in a couple of sentences --> ### What's changed <!-- Describe point by point the different things you have changed in this PR --> <!-- You can also choose to add a list of changes and if they have been completed or not by using the markdown to-do list syntax - [ ] Not Completed - [x] Completed --> ### Notes to reviewers <!-- Any information you feel the reviewer should know about when reviewing your PR --> <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Prevents open redirects in the desktop auth callback by parsing redirect_uri and strictly limiting allowed hosts to loopback. Blocks malicious URLs like http://localhost.evil.com. - **Bug Fixes** - Use URL parsing instead of a startsWith check. - Allow only http scheme and hosts: localhost, 127.0.0.1, [::1]; otherwise return 400. <sup>Written for commit 478433e10b4c30c22a81834ac3f9ea1f355865ef. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#5330
No description provided.