feat: enhance redirect logic in auth controller to include onboarding parameter#2476
Merged
JivusAyrus merged 5 commits intomainfrom Jan 29, 2026
Merged
Conversation
Contributor
WalkthroughConsolidates post-authentication redirect logic: computes a single targetUrl starting from webBaseUrl, conditionally replaces it with a validated same-origin redirectURL, appends onboarding=true when orgs === 0, and always redirects to the computed targetUrl. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
Contributor
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@controlplane/src/core/controllers/auth.ts`:
- Around line 403-407: The current startsWith check is vulnerable; instead parse
redirectURL and opts.webBaseUrl with the URL constructor and verify the
redirect's origin (protocol + hostname + port) exactly matches the web base
origin before assigning targetUrl. Update the logic around
targetUrl/redirectURL/opts.webBaseUrl to: try constructing new URL(redirectURL)
and new URL(opts.webBaseUrl), compare url.origin (or url.protocol, url.hostname
and url.port) for equality, and only set targetUrl = redirectURL when the
origins match; on parse error or mismatch keep targetUrl = opts.webBaseUrl.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2476 +/- ##
==========================================
+ Coverage 1.50% 63.20% +61.70%
==========================================
Files 292 296 +4
Lines 46748 41480 -5268
Branches 431 4312 +3881
==========================================
+ Hits 703 26219 +25516
+ Misses 45762 15239 -30523
+ Partials 283 22 -261
🚀 New features to boost your workflow:
|
…gin matches web base URL
thisisnithin
approved these changes
Jan 29, 2026
5 tasks
maxbol
pushed a commit
to maxbol/cosmo
that referenced
this pull request
Feb 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.
Checklist