Skip to content

fix: Replace innerHTML with textContent to fix security scanner false positive#2

Draft
Copilot wants to merge 2 commits intodevelopfrom
copilot/workaround-innerhtml-issue
Draft

fix: Replace innerHTML with textContent to fix security scanner false positive#2
Copilot wants to merge 2 commits intodevelopfrom
copilot/workaround-innerhtml-issue

Conversation

Copy link
Copy Markdown

Copilot AI commented Jan 16, 2026

📑 Summary

Fixes CodeQL/GitHub Advanced Security false positive flagging innerHTML usage in demos/flowchart.html as a "high severity security vulnerability" (DOM text reinterpreted as HTML).

📏 Design Decisions

The changeTheme() function restores diagram source text that was originally captured via textContent. Since this is plain text mermaid syntax (not HTML), using textContent for restoration is semantically correct and eliminates the security warning.

- elem.innerHTML = source;
+ elem.textContent = source;

📋 Tasks

Make sure you

  • 📖 have read the contribution guidelines
  • 💻 have added necessary unit/e2e tests.
  • 📓 have added documentation. Make sure MERMAID_RELEASE_VERSION is used for all new features.
  • 🦋 If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.
Original prompt

Upstream toolchain complained about the innerHTML usage in the flowchart.html as a "high severity security vulnerability", which I think is a false positive. Please find a way to workaround the issue so that the PR can be upstreamed. cf. mermaid-js#7318


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…tive

Co-authored-by: vicaya <11239+vicaya@users.noreply.github.com>
Copilot AI changed the title [WIP] Workaround high severity security vulnerability in flowchart.html fix: Replace innerHTML with textContent to fix security scanner false positive Jan 16, 2026
Copilot AI requested a review from vicaya January 16, 2026 06:58
vicaya pushed a commit that referenced this pull request Mar 14, 2026
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.

2 participants