dompurify

DOMPurify is a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG. It runs as JavaScript and works in all modern browsers, as well as in Node.js (via jsdom). DOMPurify is written by security people who have vast background in web a

3.5.1Latest, 2 Dec 2026
446MDownloads, last month
0Advisories on the latest
35Advisories, all versions
(MPL-2.0 OR Apache-2.0)Licence
18KStars
9.7/10OpenSSF Scorecard

Known advisories

Severity Advisory Fix Published
High DOMPurify SAFE_FOR_TEMPLATES bypass: nested <form> makes a template expression reassemble when sanitized output is reparsed CVE-2026-144292 Fixed in 3.5.0 3 Dec 2026
Moderate DOMPurify: SAFE_FOR_TEMPLATES bypass: template expressions reassemble when sanitized output is reparsed (nested <form> and orphaned end tags) CVE-2026-140391 Fixed in 3.4.18 3 Dec 2026
Low DOMPurify: SMIL attributeName=href guard is skipped when PARSER_MEDIA_TYPE is application/xhtml+xml CVE-2026-116802 Fixed in 3.4.17 22 Oct 2026
Low DOMPurify SAFE_FOR_TEMPLATES bypass: split template expressions survive in attached shadow root content on DOM output modes CVE-2026-116804 Fixed in 3.4.17 22 Oct 2026
Low 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) CVE-2026-116803 Fixed in 3.4.17 22 Oct 2026
Low DOMPurify: IN_PLACE returns a force-removed rawtext root whose text carries attacker markup — pure HTML reparse executes CVE-2026-109345 Fixed in 3.4.16 5 Oct 2026
Low DOMPurify: IN_PLACE: node-removing afterSanitize hook leaves detached subtree event handlers armed, causing DOM XSS CVE-2026-109344 Fixed in 3.4.16 30 Sep 2026
Moderate DOMPurify: IN_PLACE hook removal leaves a detached subtree executable, causing XSS CVE-2026-75838 Fixed in 3.4.13 7 Aug 2026
Low DOMPurify: `CUSTOM_ELEMENT_HANDLING` bypasses `afterSanitizeElements` for allowed custom elements. CVE-2026-66010 Fixed in 3.4.12 21 Jul 2026
Moderate DOMPurify: Permanent `ALLOWED_ATTR` pollution via `setConfig()` bypassing the hook clone-guard (incomplete fix of the 3.4.7 hook-pollution patch) CVE-2026-65898 Fixed in 3.4.11 18 Jun 2026
Moderate DOMPurify: Hook mutation of `data.allowedTags` / `data.allowedAttributes` permanently pollutes `DEFAULT_ALLOWED_TAGS` / `DEFAULT_ALLOWED_ATTR` CVE-2026-65902 Fixed in 3.4.7 15 Jun 2026
Low DOMPurify: SAFE_FOR_TEMPLATES bypass - template expressions survive sanitization inside <template> content when using DOM output modes CVE-2026-65900 Fixed in 3.4.8 15 Jun 2026
Moderate DOMPurify: Cross-realm IN_PLACE sanitization leaves executable markup intact via realm-bound `instanceof` checks CVE-2026-49458 Fixed in 3.4.6 15 Jun 2026
Moderate DOMPurify: IN_PLACE mode preserves attributes of a clobbered root element, allowing XSS via attacker-controlled root DOM CVE-2026-49459 Fixed in 3.4.6 15 Jun 2026
Moderate DOMPurify IN_PLACE Sanitization Bypass via Attached Shadow Root Inside <template>.content CVE-2026-49978 Fixed in 3.4.7 15 Jun 2026

In the news

On Hacker News

Sources: npm, deps.dev (CC BY 4.0), OSV. Last checked 4 Dec 2026.