Skip to content

fix(tooltip): prevent XSS in default HTML rendering - #369

Merged
hustcc merged 10 commits into
masterfrom
fix/tooltip-xss
Sep 21, 2026
Merged

hustcc merged 10 commits into
masterfrom
fix/tooltip-xss

Conversation

@interstellarmt

Copy link
Copy Markdown
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

Copilot AI lite review requested due to automatic review settings September 20, 2026 06:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Medium severity

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 escapeHtml unit 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.

Comment thread src/ui/tooltip/index.ts
Comment thread src/ui/tooltip/index.ts Outdated
@antvis antvis deleted a comment from hustcc Sep 20, 2026
@hustcc
hustcc merged commit cb9033c into master Sep 21, 2026
2 checks passed
@hustcc
hustcc deleted the fix/tooltip-xss branch September 21, 2026 07:30
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.

3 participants