Open Redirect via Untrusted URLs
Description
Detects user input flowing into redirect functions without URL validation.
What Shoulder detects
How to fix
Validate redirect URLs against an allowlist or ensure they are relative paths.
```javascript
const ALLOWED = ['/home', '/dashboard', '/profile'];
if (ALLOWED.includes(url) || url.startsWith('/')) {
res.redirect(url);
}
```
Learn more: https://shoulder.dev/learn/javascript/cwe-601/open-redirect
Applies to
Languages
Frameworks
nodejs
express
fastify
koa
hapi
nestjs
nextjs
References
Scan for this issue
Detect with Shoulder CLI
npx @shoulderdev/cli trust --rule=javascript-open-redirect .
Real-world examples
Known CVEs in the Open Redirect vulnerability class that this rule helps detect.