fix: prevent XSS in tooltip title - #4640
Open
xuefei1313 wants to merge 1 commit into
Open
Conversation
xuefei1313
marked this pull request as ready for review
August 7, 2026 03:05
skie1997
approved these changes
Aug 7, 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.
修改内容
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 --runInBandtsc --noEmit --pretty falseeslint src/plugin/components/tooltip-handler/dom-tooltip-handler.ts __tests__/unit/component/tooltip/dom-tooltip-handler.test.tsrush test --only tag:package:77 个测试套件、399 个测试通过