Skip to content

fix: prevent XSS in tooltip title - #4640

Open
xuefei1313 wants to merge 1 commit into
developfrom
agent/fix-tooltip-title-xss
Open

fix: prevent XSS in tooltip title#4640
xuefei1313 wants to merge 1 commit into
developfrom
agent/fix-tooltip-title-xss

Conversation

@xuefei1313

Copy link
Copy Markdown
Contributor

修改内容

  • DOM tooltip title 改用 textContent,不再将 title 直接写入 innerHTML
  • 增加恶意 <img onerror> title 不会生成 DOM 节点的回归测试

原因与影响

默认 DOM tooltip handler 直接把可由用户 spec 提供的 title 写入 innerHTML,攻击者可借此注入可执行 HTML。修复后 title 默认按纯文本渲染,不影响 updateElement 自定义 DOM 能力。

验证

  • jest __tests__/unit/component/tooltip/dom-tooltip-handler.test.ts --runInBand
  • tsc --noEmit --pretty false
  • eslint src/plugin/components/tooltip-handler/dom-tooltip-handler.ts __tests__/unit/component/tooltip/dom-tooltip-handler.test.ts
  • pre-push rush test --only tag:package:77 个测试套件、399 个测试通过

@github-actions github-actions Bot added the vchart label Aug 7, 2026
@xuefei1313
xuefei1313 marked this pull request as ready for review August 7, 2026 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants