-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat(router-core, react-router, solid-router, vue-router): isDangerousProtocol uses customizable blocklist #6542
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
base: main
Are you sure you want to change the base?
Conversation
…sProtocol uses customizable blocklist
📝 Walkthrough📝 Walkthrough🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
|
View your CI Pipeline Execution ↗ for commit 0783869
☁️ Nx Cloud last updated this comment at |
| // Block dangerous protocols in redirect href | ||
| if ( | ||
| !opts._builtLocation && | ||
| typeof opts.href === 'string' && | ||
| isDangerousProtocol(opts.href) | ||
| ) { | ||
| throw new Error( | ||
| `Redirect blocked: unsafe protocol in href "${opts.href}". Only ${SAFE_URL_PROTOCOLS.join(', ')} protocols are allowed.`, | ||
| ) | ||
| } | ||
|
|
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.
We don't need to check here, since a redirect() is always handled by something else that will check, right?
blob:anddata:are widely used protocols (so we should have a way to allow them), but they can also be considered dangerous if displaying untrusted links (so we should have a way to block them)List of CVEs about unsafe URL protocols:
Summary by CodeRabbit
protocolBlocklistoption toRouterOptionsacross React Router, Solid Router, and Vue Router. Users can now customize which URL protocols are blocked for links, redirects, and navigation.DEFAULT_PROTOCOL_BLOCKLISTas a public constant for reference when customizing protocol blocking behavior.✏️ Tip: You can customize this high-level summary in your review settings.