dompurify
3.5.0 · 22 Nov 2026(MPL-2.0 OR Apache-2.0)106.1M / weekRepositorynpmAtom feed
Upgrading dompurify From 3.4.15 to 3.5.0
4 releases in betweenevery note read
Before you upgrade
Tick each one off as you go- Breaking3.4.18
Security
Fixes 5 advisories affecting 3.4.15
- DOMPurify: IN_PLACE returns a force-removed rawtext root whose text carries attacker markup — pure HTML reparse executeslow · GHSA-6688-9rhm-gjv2
- DOMPurify: SMIL attributeName=href guard is skipped when PARSER_MEDIA_TYPE is application/xhtml+xmllow · GHSA-c6gr-qvv4-5v3f
- DOMPurify SAFE_FOR_TEMPLATES bypass: split template expressions survive in attached shadow root content on DOM output modeslow · GHSA-cg2g-xh64-v4q7
- 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)low · GHSA-mrv2-3pqr-j5jr
- DOMPurify: IN_PLACE: node-removing afterSanitize hook leaves detached subtree event handlers armed, causing DOM XSSlow · GHSA-p98j-92pf-mc4p
- 3.5.0
This release contains security fixes and a few behavior changes, see below.
Release by release
- Security
This release contains security fixes and a few behavior changes, see below.
- New
Added in-depth hardening against clobbering for
IN_PLACE - New
Added regression tests for all of the above
- Fixed
Fixed a further
SAFE_FOR_TEMPLATESbypass where nested tags could reassemble expressions on reparse, thanks @e1abrador
- Security
- Breaking
Removed several entries from the SVG tag allow-list that are attributes and not elements, thanks @hackvertor
- New
Added a console warning when
USE_PROFILESis combined withALLOWED_TAGSorALLOWED_ATTR, thanks @rugk - Fixed
Fixed a
SAFE_FOR_TEMPLATESbypass where the final scrub cut through tags and let a template expression form on reparse, thanks @e1abrador - Fixed
Fixed a direct property read in the clobbering check, thanks @trace37labs
- Fixed
Fixed a hook-widened allow-list carrying over when the config object received by a hook was passed back to
sanitize()
- Breaking
- New
Added a purify-edge test runner as a compatibility check, thanks @anzal1
- Fixed
Fixed an issue with
IN_PLACE,SAFE_FOR_TEMPLATESand shadow roots, thanks @manus-pi - Fixed
Fixed
IN_PLACEhandling of nodes that hooks or custom elements tough during sanitization, thanks @uttej-badwane - Fixed
Fixed the SMIL
attributeNameguard in XHTML mode, thanks @Koukyosyumei
- New
- Fixed
Fixed a problem with
IN_PLACEnode removal when working with hooks, thanks @manus-pi - Fixed
Fixed a problem with
IN_PLACEsanitization and raw-text roots, thanks @h-t-m - Fixed
Fixed a problem with ESM default exports landing in CommonJS declarations, thanks @ssi02014
- Fixed
16 other lines we could not sort, mostly version bumps
- 3.5.0
Reworked the CI setup: one always-on workflow with a single required check, a read-only build job for the SLSA provenance, and a check that the tagged
dist/matches a clean build - 3.5.0
Extended the Sigstore signatures to all four bundles covered by the provenance
- 3.5.0
Updated the README, SECURITY.md and wiki
- 3.5.0
Updated several dependencies
- 3.5.0
SAFE_FOR_TEMPLATESis guaranteed for string input. For DOM node input andIN_PLACEit is best effort, because a tree the HTML parser did not build can change shape when it is parsed again - 3.5.0
A name passing
CUSTOM_ELEMENT_HANDLING.tagNameCheckis only kept in HTML. Inside SVG or MathML it is not a custom element and is now removed - 3.5.0
When a DOM node is passed in, a
textareaortitleholding an element child and a void element holding children are removed. The HTML parser never produces these, so string input is not affected - 3.5.0
A
sanitize()call made from a hook no longer changes how the rest of the outer call behaves. Code that relied on the old side effect needs to pass the config explicitly - 3.5.0
IN_PLACEnow throws when a hook or custom element keeps putting a removed node back, instead of returning the node or running indefinitely - 3.4.18
Refactored the code base: removed dead code and redundant helpers, shortened comments
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.