Repository navigation
Releases
Releases · cure53/DOMPurify
DOMPurify 3.5.0
This release contains security fixes and a few behavior changes, see below. There will be no further 3.4.x release.
Changelog
- Fixed a further
SAFE_FOR_TEMPLATESbypass where nested tags could reassemble expressions on reparse, thanks @e1abrador - Fixed several ways for DOM-built input to get a template expression past
SAFE_FOR_TEMPLATES: entity-encoded text in astyleelement nested in atextareaortitle, text hidden in the children of a void element, NUL characters splitting a marker, and comments that end early on reparse - Fixed several gaps in the
IN_PLACEfail-closed handling: a rejected root is now neutralized inside its open shadow roots, a failed call no longer leaves text or comments in the root, and a removed node that a hook or custom element puts back is sanitized again - Fixed a case where
IN_PLACEnever returned because a custom element or hook kept re-inserting a removed node, the call now fails closed - Fixed custom elements kept via
CUSTOM_ELEMENT_HANDLINGskipping the namespace check - Fixed a crash in the attribute loop when an
uponSanitizeAttributehook removed several attributes of the current node - Fixed a
sanitize()call made from inside a hook or config callback replacing the config of the outer call - Fixed the types for
RETURN_DOM, see #1728, thanks @YevheniiKotyrlo - Added in-depth hardening against clobbering for
IN_PLACE - Added regression tests for all of the above
- 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 - Extended the Sigstore signatures to all four bundles covered by the provenance
- Updated the README, SECURITY.md and wiki
- Updated several dependencies
Behavioral changes
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- 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 - 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 - 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 IN_PLACEnow throws when a hook or custom element keeps putting a removed node back, instead of returning the node or running indefinitely
DOMPurify 3.4.18
- Fixed a
SAFE_FOR_TEMPLATESbypass where the final scrub cut through tags and let a template expression form on reparse, thanks @e1abrador - Fixed a direct property read in the clobbering check, thanks @trace37labs
- Removed several entries from the SVG tag allow-list that are attributes and not elements, thanks @hackvertor
- Added a console warning when
USE_PROFILESis combined withALLOWED_TAGSorALLOWED_ATTR, thanks @rugk - Refactored the code base: removed dead code and redundant helpers, shortened comments
- Fixed a hook-widened allow-list carrying over when the config object received by a hook was passed back to
sanitize() - Documented that the content of closed shadow roots cannot be sanitized (README and wiki)
- Updated the README, the wiki and the list of contributors
- Updated several dependencies
DOMPurify 3.4.17
- Fixed an issue with
IN_PLACE,SAFE_FOR_TEMPLATESand shadow roots, thanks @manus-pi - Fixed
IN_PLACEhandling of nodes that hooks or custom elements tough during sanitization, thanks @uttej-badwane - Fixed the SMIL
attributeNameguard in XHTML mode, thanks @Koukyosyumei - Hardened several smaller edge cases (namespaces, literal-text elements,
isValidAttribute()), thanks @Artiphishell - Added a purify-edge test runner as a compatibility check, thanks @anzal1
- Clarified the
IN_PLACEdocumentation in the README about possible risks - Updated several dependencies
DOMPurify 3.4.16
- Fixed a problem with
IN_PLACEnode removal when working with hooks, thanks @manus-pi - Fixed a problem with
IN_PLACEsanitization and raw-text roots, thanks @h-t-m - Fixed a problem with ESM default exports landing in CommonJS declarations, thanks @ssi02014
- Migrated from
rolluptorolldownbecause performance, thanks @ssi02014 - Bumped several dependencies where possible
DOMPurify 3.4.15
- Added better clobbering hardening when XML content is involved, thanks @gnyselcuk
- Added several smaller hardening and edge-case improvements, thanks @leechristensen
- Bumped several dependencies where possible
DOMPurify 3.4.14
- Fixed an issue with possible bypasses when risky tags are allow-listed, thanks @alirezarouhbakhsh
- Fixed a couple of edge cases with mixed document contexts, thanks @fishjojo1
- Added the SVG
pointer-eventsandvector-effectpresentation attributes to the allow-list, thanks @Jaybhade - Conducted another refactoring run, removed dead branches and duplicated logic, flattened attribute validation
- Updated the documentation in several spots, README, wiki, etc., thanks @Akokonunes
- Updated several development dependencies and CI workflow actions
DOMPurify 3.4.13
- Fixed an issue with hook removal during
IN_PLACEsanitization, thanks @koyokr - Fixed an issue with hooks potentially bypassing the clone guard, thanks @AkshayJainG
- Fixed an issue with DOM clobbering via
ownerDocumentduringIN_PLACE, thanks @AkshayJainG - Bumped several dependencies where possible
DOMPurify 3.4.12
- Fixed an issue where a hook would not get called for custom elements, thanks @Rikuxx0
- Hardened the handling of hooks removing elements, @mkrause-bee360
- Added support for a few new SVG attributes, thanks @cbn-falias & @Develop-KIM
- Hardened the handling of declarative partial updates
- Updated the documentation is several spots, README, wiki, etc.
- Bumped several dependencies where possible
DOMPurify 3.4.11
- Fixed an issue with a leaky config for hooks via
setConfig, thanks @trace37labs - Bumped vulnerable development dependencies to arrive at plain 0 with
npm audit - Updated the
osv-scannersuppression list as no vulnerable dependencies are left for now - Updated up the linting tool-chain and removed now-redundant lint directives
- Updated the documentation is several spots, README, wiki, etc.
- Bumped several dependencies where possible
DOMPurify 3.4.10
- Refactored codebase for clarity: extracted the public type declarations into
types.ts - Decomposed the three largest sanitizer functions into focused helpers
- Removed duplicated defaults and dead branches, consolidated
SAFE_FOR_TEMPLATESscrubbing into single shared path - Improved per-node performance by hoisting the mXSS probe regexes and testing
textContentbeforeinnerHTML - Added a deterministic micro-benchmark harness (
npm run bench) with a--comparemode - Reduced CI cost by running the full three-engine browser suite once per PR
- Refreshed the
demos/folder so every demo runs again, and added a SVG-via-<img>demo - Documented the bench and
test:happydomscripts in the README - Completed the Attack Classes & Bypass History wiki page
- Bumped several dependencies where possible