-
Notifications
You must be signed in to change notification settings - Fork 3
CDM-350 Add external URL redirect whitelist for nextRequest #252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+269
−12
Conversation
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
93198bf to
2caa2f6
Compare
Allow nextRequest parameter to redirect to external URLs on whitelisted domains after login. This enables cross-subdomain redirects (e.g., from narrative.kbase.us to hub.berdl.kbase.us) while maintaining security. Features: - Configurable whitelist via redirect_whitelist in config.json - Wildcard support (e.g., *.berdl.kbase.us) - HTTPS-only enforcement - TLD-only wildcards rejected for security (e.g., *.com blocked) - Blocked redirects show toast and fall back to /narratives
2caa2f6 to
d778ff7
Compare
Handles case variations like HTTPS://, HTTP://, Https:// to prevent potential issues with non-lowercase URL schemes.
briehl
requested changes
Jan 15, 2026
Member
briehl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's a couple issues with possible hijacking.
a928690 to
8c5934d
Compare
- Remove isValidWildcardPattern function (provided false sense of security) - Trust whitelist as configured, only reject literal "*" - Add default whitelist value (*.kbase.us) for local development - Clarify .env header comment about config.json overwriting values
8c5934d to
3bb3d54
Compare
briehl
approved these changes
Jan 15, 2026
Member
briehl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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
nextRequestto redirect to external URLs on whitelisted domains after loginnarrative.kbase.ustohub.berdl.kbase.us)How to Whitelist URLs for Redirect
1. Configure the whitelist in
config.jsonAdd a
redirect_whitelistarray to any environment that needs external redirects:{ "environments": { "production": { "domain": "narrative.kbase.us", ... "redirect_whitelist": ["*.berdl.kbase.us"] } } }2. Wildcard patterns
*.berdl.kbase.us- Matcheshub.berdl.kbase.us,hub.dev.berdl.kbase.us, etc.*.kbase.us- Matches any*.kbase.ussubdomainhub.berdl.kbase.us- Matches exact domain only*.comare rejected for security3. Usage
Pass the full external URL as the
nextRequestparameter:After successful login, the user will be redirected to the external URL.
Security
/narrativesTest plan
nextRequest(JSON-encoded paths) still works