Skip to content

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

Merged
shirokuma-xv merged 1 commit into
mainfrom
alert-autofix-5
Oct 17, 2026
Merged

shirokuma-xv merged 1 commit into
mainfrom
alert-autofix-5

Conversation

@shirokuma-xv

Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/VIUK-Light/Omoi/security/code-scanning/5

To fix this, remove the unsafe string-concatenation navigation and use only URL + searchParams for all redirects. This prevents reinterpreting DOM text in unsafe contexts and ensures encoding is consistently applied.

Best single fix in select.js:

  • In the click handler:
    • For selectedLevel === "4": remove the dead/unsafe intermediate assignment and keep only warningUrl creation + searchParams.set("count", selectedCount) + final navigation.
    • For selectedLevel === "3": same pattern with warning3Url.
    • For default branch: remove window.location.href = "question.html?level=" + selectedLevel; ... concatenation block, and keep only questionUrl.searchParams.set("level", selectedLevel) and set("count", selectedCount) followed by navigation.
  • Do not change functionality; just eliminate vulnerable/redundant assignments and rely on the already-safe API path.

No new imports or helper methods are 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>
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 75566ec2-c157-4e80-a9e2-39cbace7853c
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@shirokuma-xv
shirokuma-xv marked this pull request as ready for review October 17, 2026 12:44
@shirokuma-xv
shirokuma-xv merged commit 1be18c4 into main Oct 17, 2026
3 of 5 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