Open Redirect
Description
Detects unvalidated redirects using user input.
How to fix
Validate redirect URLs against an allowlist of permitted domains.
```python
from urllib.parse import urlparse
ALLOWED_DOMAINS = {"myapp.com"}
if urlparse(url).netloc not in ALLOWED_DOMAINS:
url = "/"
```
Learn more: https://shoulder.dev/learn/python/cwe-601/open-redirect
Applies to
Languages
Frameworks
flask
django
fastapi
References
Scan for this issue
Detect with Shoulder CLI
npx @shoulderdev/cli trust --rule=python-open-redirect .
Real-world examples
Known CVEs in the Open Redirect vulnerability class that this rule helps detect.