-
Notifications
You must be signed in to change notification settings - Fork 25
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
Candidature: traitement par lot [GEN-1949] #5242
Conversation
2d161d7
to
a7a5fae
Compare
🥁 La recette jetable est prête ! 👉 Je veux tester cette PR ! |
ec04e9e
to
7cc3864
Compare
86197bb
to
f61e6cc
Compare
c48a175
to
7aa8731
Compare
bbdd791
to
81e4c07
Compare
14bb543
to
a55404b
Compare
5f7e775
to
36466b2
Compare
a625e54
to
3aa57c1
Compare
3aa57c1
to
8933e0e
Compare
8933e0e
to
c25bc84
Compare
) | ||
|
||
if not application_ids: | ||
return HttpResponseRedirect(next_url) |
Check warning
Code scanning / CodeQL
URL redirection from remote source Medium
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 3 days ago
To fix the problem, we need to ensure that the next_url
is validated before it is used in the redirection. We can use Django's url_has_allowed_host_and_scheme
function to check that the URL is safe to redirect to. This function ensures that the URL is either relative or belongs to an allowed host.
We will modify the refuse
function to include this validation step. If the next_url
is not valid, we will redirect to a default safe URL (e.g., the home page).
-
Copy modified line R12 -
Copy modified lines R176-R177
@@ -11,2 +11,3 @@ | ||
from django.utils import timezone | ||
from django.utils.http import url_has_allowed_host_and_scheme | ||
from django.views.decorators.http import require_POST | ||
@@ -174,4 +175,4 @@ | ||
next_url = get_safe_url(request, "next_url") | ||
if next_url is None: | ||
# This is somewhat extreme but will force developpers to always provide a proper next_url | ||
if next_url is None or not url_has_allowed_host_and_scheme(next_url, allowed_hosts=None): | ||
# This is somewhat extreme but will force developers to always provide a proper next_url | ||
raise Http404 |
since it will become more complex for batch refuse
c25bc84
to
aceb5ee
Compare
🤔 Pourquoi ?
🍰 Comment ?
🚨 À vérifier
🏝️ Comment tester
💻 Captures d'écran