fix(tooltip): prevent XSS in default HTML rendering - #369
Merged
Merged
Conversation
interstellarmt
commented
Sep 20, 2026
Member
- render dynamic tooltip titles as text
- escape item data before HTML template substitution
- validate and normalize marker colors with the DOM CSS parser
- prevent data-index attribute escaping
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The security-sensitive tooltip rendering path lacks regression tests covering the new sanitization behavior.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Hardens default tooltip HTML rendering against XSS by escaping item data, validating colors, and rendering titles as text.
Changes:
- Added reusable HTML escaping.
- Sanitized tooltip item values and colors.
- Added an
escapeHtmlunit test.
| File | Description |
|---|---|
src/util/string.ts |
Adds HTML escaping utility. |
src/ui/tooltip/index.ts |
Sanitizes tooltip content and titles. |
__tests__/unit/util/string.spec.ts |
Tests HTML escaping. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
hustcc
reviewed
Sep 20, 2026
hustcc
approved these changes
Sep 21, 2026
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.
