-
Notifications
You must be signed in to change notification settings - Fork 27
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
Move from pennydreadfulmagic.com cookies to .pennydreadfulmagic.com cookies #13309
Conversation
…ookies This will let us know you are an admin on logs. I'm not sure what changed here, maybe the config got messed up? But this will put us back in the right spot.
@@ -92,8 +92,14 @@ | |||
oauth.logout() | |||
target = request.args.get('target', 'home') | |||
if bool(urllib.parse.urlparse(target).netloc): | |||
return redirect(target) | |||
return redirect(url_for(target)) | |||
response = redirect(target) |
Check warning
Code scanning / CodeQL
URL redirection from remote source Medium
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 4 months ago
To fix the problem, we need to ensure that the target
parameter is validated properly before using it in a redirect. One way to do this is to maintain a list of allowed redirect targets and check that the user-provided target
is in this list. If the target
is not in the list, we should redirect to a default safe location.
- Create a list of allowed redirect targets.
- Check if the
target
parameter is in the list of allowed targets. - If the
target
is not in the list, redirect to a default safe location.
-
Copy modified line R93 -
Copy modified line R95 -
Copy modified lines R97-R98
@@ -92,7 +92,8 @@ | ||
oauth.logout() | ||
ALLOWED_REDIRECTS = ['home', 'profile', 'dashboard'] # Add all allowed targets here | ||
target = request.args.get('target', 'home') | ||
if bool(urllib.parse.urlparse(target).netloc): | ||
response = redirect(target) | ||
else: | ||
if target in ALLOWED_REDIRECTS: | ||
response = redirect(url_for(target)) | ||
else: | ||
response = redirect(url_for('home')) | ||
# Clean up any session cookie set with no domain created when the site was misconfigured. |
This will let us know you are an admin on logs.
I'm not sure what changed here, maybe the config got messed up? But this will
put us back in the right spot.