-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Updating production: new concordances #479
Conversation
…e public view, without "approved"
…eletion for old format + template updates + styling
Feature/new concordances tc fixes
… feature/new-concordances
Feature/new concordances
Feature/new concordances updates
) | ||
|
||
options = empty_option + part_options | ||
return HttpResponse(options) |
Check warning
Code scanning / CodeQL
Reflected server-side cross-site scripting Medium
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 1 month ago
To fix the reflected server-side cross-site scripting vulnerability, we need to escape the user-provided input before including it in the HTML response. In Django, we can use the django.utils.html.escape
function to properly escape any HTML special characters in the user input.
Steps to fix:
- Import the
escape
function fromdjango.utils.html
. - Use the
escape
function to sanitize thepart.value
before including it in the HTML options.
-
Copy modified line R2 -
Copy modified line R51
@@ -1,2 +1,3 @@ | ||
from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin | ||
from django.utils.html import escape | ||
from django.db import DatabaseError | ||
@@ -49,3 +50,3 @@ | ||
[ | ||
f'<option value="{part.id}">{part.value}</option>' | ||
f'<option value="{part.id}">{escape(part.value)}</option>' | ||
for part in parts |
@@ -123,6 +123,8 @@ | |||
|
|||
<script src="{%static 'js/ckeditor/ckeditor.js'%}"></script> | |||
|
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.min.js"></script> |
Check warning
Code scanning / CodeQL
Inclusion of functionality from an untrusted source Medium
No issues reported from research team so will merge into production