Skip to content

Potential fix for code scanning alert no. 5: DOM text reinterpreted as HTML - #6

Merged
albert-mueller merged 1 commit into
mainfrom
alert-autofix-5
Aug 6, 2026
Merged

Potential fix for code scanning alert no. 5: DOM text reinterpreted as HTML#6
albert-mueller merged 1 commit into
mainfrom
alert-autofix-5

Conversation

@albert-mueller

Copy link
Copy Markdown
Owner

Potential fix for https://github.com/albert-mueller/albert-mueller.github.io/security/code-scanning/5

General fix: avoid injecting untrusted values into innerHTML; instead build DOM nodes with createElement and assign untrusted text via textContent (or innerText). This preserves display behavior while preventing HTML interpretation.

Best fix in others/translate/app.js around handleFileUpload (lines ~2318 onward): replace the template-literal fileItem.innerHTML = ... block with explicit DOM construction. Keep static classes/structure the same, set:

  • icon text via textContent (safe even if emoji/string),
  • file name via textContent (critical fix),
  • file size via textContent,
  • remove button title/class and visible “×” via text node.
    Then append the built subtree to fileItem. No new imports/dependencies needed.

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

…s HTML

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Albert Müller <p8bpg9zrw7@privaterelay.appleid.com>
@albert-mueller
albert-mueller marked this pull request as ready for review August 6, 2026 00:43
@albert-mueller
albert-mueller merged commit acd0e01 into main Aug 6, 2026
3 checks passed
@albert-mueller
albert-mueller deleted the alert-autofix-5 branch August 6, 2026 02:20
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