Skip to content
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

Merged
merged 106 commits into from
Oct 14, 2024
Merged

Updating production: new concordances #479

merged 106 commits into from
Oct 14, 2024

Conversation

acholyn
Copy link
Collaborator

@acholyn acholyn commented Oct 14, 2024

No issues reported from research team so will merge into production

acholyn added 30 commits May 3, 2024 14:17
…eletion for old format + template updates + styling
acholyn and others added 28 commits August 29, 2024 14:15
)

options = empty_option + part_options
return HttpResponse(options)

Check warning

Code scanning / CodeQL

Reflected server-side cross-site scripting Medium

Cross-site scripting vulnerability due to a
user-provided value
.

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:

  1. Import the escape function from django.utils.html.
  2. Use the escape function to sanitize the part.value before including it in the HTML options.
Suggested changeset 1
src/rard/research/views/concordance.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/rard/research/views/concordance.py b/src/rard/research/views/concordance.py
--- a/src/rard/research/views/concordance.py
+++ b/src/rard/research/views/concordance.py
@@ -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
EOF
@@ -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
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@@ -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

Script loaded from content delivery network with no integrity check.
@acholyn acholyn merged commit aeddfbc into production Oct 14, 2024
12 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants