Upgrading dompurify 2 to 3
Breaking2.5.9 → 3.4.17Breaking1Security70Platform1Deprecated1New18Changed18Fixed51Other43
Fetching 50 releases from GitHub…40 / 50
SecurityHighDOMPurify IN_PLACE: hook that removes a parent or sibling leaves the detached subtree's event handlers armed (incomplete fix for GHSA-p98j-92pf-mc4p)GHSA-mrv2-3pqr-j5jr · CVE-2026-116803 ↗
BreakingUpgrade verdict
1 breaking change and a platform requirement change and 69 security fixes.
In plain terms
- Content inside SVG foreignObject elements is no longer treated as an allowed HTML entry point, so it may be sanitized away.
- Testing now covers Node 23.x instead of Node 17.x.
- DOMPurify IN_PLACE: hook that removes a parent or sibling leaves the detached subtree's event handlers armed (incomplete fix for GHSA-p98j-92pf-mc4p)
- DOMPurify SAFE_FOR_TEMPLATES bypass: split template expressions survive in attached shadow root content on DOM output modes
Must act Top 5 of 72 that need code or config changes
Adds @types/trusted-types ^2.0.7.
Installs 1 package in all (was 0).
What you must change
Breaking1
Removes the foreignObject element from the list of HTML entry-points.
foreignObjectSecurity69
DOMPurify IN_PLACE: hook that removes a parent or sibling leaves the detached subtree's event handlers armed (incomplete fix for GHSA-p98j-92pf-mc4p)
HighDOMPurify SAFE_FOR_TEMPLATES bypass: split template expressions survive in attached shadow root content on DOM output modes
CriticalDOMPurify: SMIL attributeName=href guard is skipped when PARSER_MEDIA_TYPE is application/xhtml+xml
LowDOMPurify: IN_PLACE: node-removing afterSanitize hook leaves detached subtree event handlers armed, causing DOM XSS
LowDOMPurify: IN_PLACE returns a force-removed rawtext root whose text carries attacker markup — pure HTML reparse executes
LowAdds better clobbering hardening when XML content is involved.
Adds several smaller hardening and edge-case improvements.
Fixes possible bypasses when risky tags are allow-listed.
Fixes hooks potentially bypassing the clone guard.
Fixes DOM clobbering via ownerDocument during IN_PLACE sanitization.
ownerDocumentIN_PLACEDOMPurify: IN_PLACE hook removal leaves a detached subtree executable, causing XSS
ModerateHardens the handling of hooks removing elements.
Hardens the handling of declarative partial updates.
DOMPurify:
LowCUSTOM_ELEMENT_HANDLING bypasses afterSanitizeElements for allowed custom elements.DOMPurify: Permanent
ModerateALLOWED_ATTR pollution via setConfig() bypassing the hook clone-guard (incomplete fix of the 3.4.7 hook-pollution patch)DOMPurify: Trusted Types policy survives
LowclearConfig() and can poison later RETURN_TRUSTED_TYPE outputDOMPurify: SAFE_FOR_TEMPLATES bypass - template expressions survive sanitization inside <template> content when using DOM output modes
LowHardens handling of Shadow Roots when using IN_PLACE.
IN_PLACEDOMPurify: Hook mutation of
Moderate · CVSS 6.1data.allowedTags / data.allowedAttributes permanently pollutes DEFAULT_ALLOWED_TAGS / DEFAULT_ALLOWED_ATTRDOMPurify IN_PLACE Sanitization Bypass via Attached Shadow Root Inside <template>.content
ModerateHardens checks for cross-realm IN_PLACE and Shadow DOM sanitization.
IN_PLACEDOMPurify: Cross-realm IN_PLACE sanitization leaves executable markup intact via realm-bound
Moderate · CVSS 6.1instanceof checksDOMPurify: IN_PLACE mode preserves attributes of a clobbered root element, allowing XSS via attacker-controlled root DOM
Moderate · CVSS 6.1Fixes a bypass caused by the new HTML element selectedcontent added in 3.4.4.
selectedcontentSecurity release for an issue introduced in 3.4.4; users should upgrade immediately.
DOMPurify XSS via selectedcontent re-clone
High · CVSS 8.2Adds stronger checks for cross-realm windows.
Fixes the template regexes to be more robust against ReDoS attacks.
DOMPurify: Prototype Pollution to XSS Bypass via CUSTOM_ELEMENT_HANDLING Fallback
CUSTOM_ELEMENT_HANDLINGModerate · CVSS 6.9Fixes ADD_TAGS function form bypassing FORBID_TAGS.
ADD_TAGSFORBID_TAGSFixes ADD_ATTR predicates skipping URI validation.
ADD_ATTRFixes prototype pollution via USE_PROFILES.
USE_PROFILESFixes a possible mXSS issue via Re-Contextualization.
Fixes an issue with closing tags leading to possible mXSS.
DOMPurify has a SAFE_FOR_TEMPLATES bypass in RETURN_DOM mode
Moderate · CVSS 6.8DOMPurify: FORBID_TAGS bypassed by function-based ADD_TAGS predicate (asymmetry with FORBID_ATTR fix)
ModerateDOMPurify's ADD_TAGS function form bypasses FORBID_TAGS due to short-circuit evaluation
ModerateFixes a possible sanitizer bypass caused by jsdom's faulty raw-text tag parsing.
Fixes a prototype pollution issue when working with custom elements.
Fixes lenient config parsing in
_isValidAttribute._isValidAttributeDOMPurify USE_PROFILES prototype pollution allows event handlers
ModerateDOMPurify contains a Cross-site Scripting vulnerability
Moderate · CVSS 6.1DOMPurify ADD_ATTR predicate skips URI validation
ModerateDOMPurify is vulnerable to mutation-XSS via Re-Contextualization
ModerateImproves handling of potentially risky content inside CDATA elements.
CDATAImproves the regular expression for raw-text elements to cover textareas.
textareaDOMPurify contains a Cross-site Scripting vulnerability
Moderate · CVSS 6.1Adds better config hardening against prototype pollution.
Removes the script that caused the fake CVE-2025-48050 entry.
Adds a stricter check to the mXSS detection regex.
Fixes a conditional and config dependent mXSS-style bypass reported by @nsysean.
DOMPurify allows Cross-site Scripting (XSS)
Moderate · CVSS 4.5Fixes two conditional sanitizer bypasses discovered by @parrot409 and @Slonser.
Updates the attribute clobbering checks to prevent future bypasses, thanks @parrot409.
Fixes a possible bypass when a rather specific custom elements config is set.
Fixes an issue with comment detection and possible bypasses under specific config settings.
Fixes an issue with the execution logic of attribute hooks to prevent bypasses.
Fixes several mXSS variations found by @kevin-mizu and @Ry0taK.
Adds better hardening against Prototype Pollution attacks, thanks @kevin-mizu.
DOMPurify allows tampering by prototype pollution
High · CVSS 7.0DOMpurify has a nesting-based mXSS
High · CVSS 10.0Fixes a mutation XSS (mXSS) variation found by @kevin-mizu.
Fixes a mutation XSS (mXSS) variation found by Adam Kues of Assetnote.
Fixes an mXSS sanitiser bypass reported by @icesfont.
Adds code to track element nesting depth.
Enforces a maximum element nesting depth of 255.
Adds coverage tests and necessary clobbering protections.
Fixes another conditional bypass caused by Processing Instructions.
Fixes two possible bypasses when sanitizing an XML document and later using it in HTML.
Platform1
Adds Node 23.x to tested runtimes and removes Node 17.x.
Deprecations to plan for
Deprecated1
Flags this release as deprecated and directs users to DOMPurify 3.4.5 instead.