dompurify
3.5.0 · 22 Nov 2026(MPL-2.0 OR Apache-2.0)106.1M / weekRepositorynpmAtom feed
In short
1 security2 new8 fixed9 changed
- Security
This release contains security fixes and a few behavior changes, see below.
Release note
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 @e1abradorFixed 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 reparseFixed 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 againFixed a case where
IN_PLACEnever returned because a custom element or hook kept re-inserting a removed node, the call now fails closedFixed custom elements kept via
CUSTOM_ELEMENT_HANDLINGskipping the namespace checkFixed a crash in the attribute loop when an
uponSanitizeAttributehook removed several attributes of the current nodeFixed a
sanitize()call made from inside a hook or config callback replacing the config of the outer callFixed the types for
RETURN_DOM, see #1728, thanks @YevheniiKotyrloAdded in-depth hardening against clobbering for
IN_PLACEAdded 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 buildExtended 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 againA name passing
CUSTOM_ELEMENT_HANDLING.tagNameCheckis only kept in HTML. Inside SVG or MathML it is not a custom element and is now removedWhen 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 affectedA
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 explicitlyIN_PLACEnow throws when a hook or custom element keeps putting a removed node back, instead of returning the node or running indefinitely
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.