-
Notifications
You must be signed in to change notification settings - Fork 0
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
Patch 6 #1
Patch 6 #1
Conversation
Build a markdown badge which shows increment in the daily repository visit count from IP, corresponding to each day of the week visualised in the form of bar graph. A total count will be shown at the top-most right corner
Scaled up the Edit Profile form to maintain consistent UI throughout the website. OWASP-BLT#2937
@@ -277,7 +298,7 @@ | |||
user_issues.update(is_hidden=hide) | |||
request.user.userprofile.issues_hidden = hide | |||
request.user.userprofile.save() | |||
return redirect(reverse("profile", kwargs={"slug": kwargs.get("slug")})) | |||
return redirect(self.request.path_info) |
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 URL used in the redirect is safe. We can use Django's url_has_allowed_host_and_scheme
function to validate the URL. This function checks that the URL is safe to redirect to by ensuring it does not include an explicit host name and is within the allowed hosts.
- Import the
url_has_allowed_host_and_scheme
function fromdjango.utils.http
. - Validate
self.request.path_info
before using it in the redirect. - If the URL is not valid, redirect to a safe default URL (e.g., the home page).
-
Copy modified line R31 -
Copy modified lines R302-R305
@@ -30,2 +30,3 @@ | ||
from django.utils.decorators import method_decorator | ||
from django.utils.http import url_has_allowed_host_and_scheme | ||
from django.views.generic import DetailView, ListView, TemplateView, View | ||
@@ -300,3 +301,6 @@ | ||
request.user.userprofile.save() | ||
return redirect(self.request.path_info) | ||
if url_has_allowed_host_and_scheme(self.request.path_info, allowed_hosts=None): | ||
return redirect(self.request.path_info) | ||
else: | ||
return redirect('/') | ||
|
No description provided.