security: upgrade dompurify to 3.4.0 for XSS protection#7737
Open
wtfiwtz wants to merge 3 commits into
Open
Conversation
Upgrade dompurify from 2.x to 3.4.0 to address XSS bypass vulnerabilities and improve DOM clobbering attack protection. Changes: - package.json: Update dompurify ^2.0.17 → ^3.4.0 - viz-lib/package.json: Update dompurify ^2.0.7 → ^3.4.0 - viz-lib/package.json: Remove @types/dompurify (no longer needed for v3) - viz-lib/src/services/sanitize.ts: Add explicit type annotation for DOMPurify 3.x sanitize() return type to ensure TypeScript declaration emit remains portable (TrustedHTML | string → string) - Regenerate pnpm-lock.yaml CVEs Addressed: - Multiple XSS bypass fixes in DOMPurify 3.x series - Improved sanitization for DOM clobbering attacks - Enhanced protection against attribute-based XSS vectors - Better handling of edge cases in HTML parsing and sanitization DOMPurify 3.x includes significant security improvements over 2.x, particularly around handling of complex HTML structures and edge cases that could lead to XSS vulnerabilities. Test Results: - Frontend tests: ✓ All 15 test suites passed (90 tests) - TypeScript compilation: ✓ Type checking passed Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Jun 2, 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.
Summary
Upgrade dompurify from 2.x to 3.4.0 to address XSS bypass vulnerabilities and improve DOM clobbering attack protection.
Changes
CVEs Addressed
This PR addresses multiple XSS vulnerabilities:
DOMPurify 3.x includes significant security improvements over 2.x, particularly around handling of complex HTML structures and edge cases that could lead to XSS vulnerabilities in previous versions.
Code Changes
The main code change is in
sanitize.tswhere we add an explicit type annotation for thesanitize()function. DOMPurify 3.x returnsTrustedHTML | string, which can break TypeScript declaration emit. The type annotation ensures portability:This change maintains backward compatibility while leveraging DOMPurify 3.x security improvements.
Test Results
Related PRs
Part of the frontend security upgrade series split from #7720:
Made with Cursor