Repository navigation
Fix more DOM text reinterpreted as HTML issues - #1567
Merged
Merged
Conversation
sayravai
force-pushed
the
fix_1566
branch
2 times, most recently
from
November 11, 2026 13:57
86e831d to
514c9cd
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Dotted module IDs can cause goal deletion to throw after succeeding and leave the UI stale, while regression coverage for text, image, and tooltip rendering remains incomplete.
3 open issues
What changed in this PR
This PR addresses #1566 by hardening A-plus exercise rendering against text being reinterpreted as HTML. It also simplifies staff submission-tag filtering and removes duplicate table-cell IDs.
Changes:
- Build points-goal tooltip content safely with DOM APIs, without reparsing existing markup.
- Render active-element titles and text feedback as text, and construct image output through DOM APIs.
- Read submission tags directly from the live DOM and use class-based selectors.
| File | Description |
|---|---|
exercise/templates/exercise/staff/_submissions_table.html |
Replace repeated tag-cell IDs with a shared class. |
exercise/static/exercise/module_goal.js |
Safely build, replace, and remove points-goal tooltip blocks. |
exercise/static/exercise/filter_submissions_by_tag.js |
Read tags directly from class-selected DOM cells. |
exercise/static/exercise/chapter.js |
Avoid HTML reinterpretation of titles, text feedback, and image data. |
course/templates/course/staff/all_submissions_table.html |
Apply the shared tag-cell class to course-wide submissions. |
Review effort: Max
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
What?
Fix several potential XSS issues found by the CodeQL scanner in module_goal.js and chapter.js. Also fix related issues (though not XSS nor reported by CodeQL) in filter_submissions_by_tag.js
How?
Issues in module_goal.js (CodeQL issues 84 and 104):
Issues in filter_submissions_by_tag.js (not mentioned by CodeQL but also involved parseFromString like above):
Issues in chapter.js (CodeQL issues 4 and 69):
All tests passed for me.
Fixes #1566
Testing
Remember to add or update unit tests for new features and changes.
What type of test did you run?
[ADD A DESCRIPTION ABOUT WHAT YOU TESTED MANUALLY]
Did you test the changes in
Think of what is affected by these changes and could become broken
Translation
Programming style
Have you updated the README or other relevant documentation?
Is it Done?
Clean up your git commit history before submitting the pull request!