Skip to content

Potential fix for code scanning alert no. 45: DOM text reinterpreted as HTML#28

Merged
paule32 merged 1 commit intomainfrom
alert-autofix-45
Oct 28, 2025
Merged

Potential fix for code scanning alert no. 45: DOM text reinterpreted as HTML#28
paule32 merged 1 commit intomainfrom
alert-autofix-45

Conversation

@paule32
Copy link
Owner

@paule32 paule32 commented Oct 28, 2025

Potential fix for https://github.com/paule32/HelpNDocTools/security/code-scanning/45

General fix:
To eliminate this DOM text–to–HTML reinterpreting risk, do not assign text content from a DOM node (via .text()) to HTML content directly (via .html()). If you must set the HTML, ensure the value is properly HTML-encoded or, better, set it as text using .text() so that jQuery will encode any potentially dangerous characters.

Specific fix:
In the function _65, instead of writing tmp.html(_6b) (where _6b could be derived from previously-extracted DOM text), use tmp.text(_6b). This way, any HTML in _6b will be properly escaped (treated as text), and there is no risk of unescaped HTML injection or XSS. This does not change the logic of the code as used here (since the purpose seems to be normalizing text).

What/where to change:

  • In src/__pycache__/_internal/bootstrap/js/easyui/plugins/jquery.tabs.js
  • Replace tmp.html(_6b); (line 515) with tmp.text(_6b);
  • No new imports or methods are required.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…as HTML

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@paule32 paule32 marked this pull request as ready for review October 28, 2025 11:30
@paule32 paule32 merged commit e84e7cb into main Oct 28, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant