Skip to content

Releases

DOMPurify 3.5.0

Choose a tag to compare

@cure53 cure53 released this 22 Nov 13:34
3.5.0
d05b243

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_TEMPLATES bypass 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 a style element nested in a textarea or title, 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_PLACE fail-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_PLACE never 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_HANDLING skipping the namespace check
  • Fixed a crash in the attribute loop when an uponSanitizeAttribute hook 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_TEMPLATES is guaranteed for string input. For DOM node input and IN_PLACE it 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.tagNameCheck is 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 textarea or title holding 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_PLACE now 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

Choose a tag to compare

@cure53 cure53 released this 14 Nov 14:14
3.4.18
37abc33
  • Fixed a SAFE_FOR_TEMPLATES bypass 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_PROFILES is combined with ALLOWED_TAGS or ALLOWED_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

Choose a tag to compare

@cure53 cure53 released this 12 Oct 12:37
3.4.17
a77a3e7
  • Fixed an issue with IN_PLACE, SAFE_FOR_TEMPLATES and shadow roots, thanks @manus-pi
  • Fixed IN_PLACE handling of nodes that hooks or custom elements tough during sanitization, thanks @uttej-badwane
  • Fixed the SMIL attributeName guard 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_PLACE documentation in the README about possible risks
  • Updated several dependencies

DOMPurify 3.4.16

Choose a tag to compare

@x00mario x00mario released this 23 Sep 15:23
3.4.16
b9b9d80
  • Fixed a problem with IN_PLACE node removal when working with hooks, thanks @manus-pi
  • Fixed a problem with IN_PLACE sanitization and raw-text roots, thanks @h-t-m
  • Fixed a problem with ESM default exports landing in CommonJS declarations, thanks @ssi02014
  • Migrated from rollup to rolldown because performance, thanks @ssi02014
  • Bumped several dependencies where possible

DOMPurify 3.4.15

Choose a tag to compare

@cure53 cure53 released this 06 Sep 11:36
3.4.15
1d7460c
  • 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

Choose a tag to compare

@cure53 cure53 released this 19 Aug 10:18
3.4.14
4e6fe24
  • 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-events and vector-effect presentation 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

Choose a tag to compare

@cure53 cure53 released this 03 Aug 14:11
3.4.13
3067f77
  • Fixed an issue with hook removal during IN_PLACE sanitization, thanks @koyokr
  • Fixed an issue with hooks potentially bypassing the clone guard, thanks @AkshayJainG
  • Fixed an issue with DOM clobbering via ownerDocument during IN_PLACE, thanks @AkshayJainG
  • Bumped several dependencies where possible

DOMPurify 3.4.12

Choose a tag to compare

@cure53 cure53 released this 11 Jul 12:02
3.4.12
a9ca1e5
  • 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

Choose a tag to compare

@cure53 cure53 released this 17 Jun 10:17
3.4.11
0cae518
  • 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-scanner suppression 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

Choose a tag to compare

@cure53 cure53 released this 12 Jun 12:34
3.4.10
6ee5716
  • 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_TEMPLATES scrubbing into single shared path
  • Improved per-node performance by hoisting the mXSS probe regexes and testing textContent before innerHTML
  • Added a deterministic micro-benchmark harness (npm run bench) with a --compare mode
  • 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:happydom scripts in the README
  • Completed the Attack Classes & Bypass History wiki page
  • Bumped several dependencies where possible