Install
sanitize-html
Clean up user-submitted HTML, preserving allowlisted elements and allowlisted attributes on a per-element basis
2.18.2Latest, 11 Nov 2026
8MDownloads, last month
0Advisories on the latest
17Advisories, all versions
MITLicence
4.7KStars
6.3/10OpenSSF Scorecard
Source · Homepage · Ask AI Mode · · Markdown
Known advisories
| Severity | Advisory | Fix | Published |
|---|---|---|---|
| Moderate | ApostropheCMS sanitize-html: unbounded recursion when re-sanitizing the fallback of a discarded iframe (stack overflow, nestingLimit not enforced) CVE-2026-113650 | Fixed in 2.18.1 | 21 Oct 2026 |
| Low | ApostropheCMS sanitize-html: SMIL animation namespace-prefix bypass allows javascript: URI injection (XSS) CVE-2026-113657 | Fixed in 2.18.0 | 20 Oct 2026 |
| Moderate | ApostropheCMS: Incomplete CVE-2026-53606: `meta http-equiv=refresh` `content` still ships `javascript:` / `data:` URLs CVE-2026-113661 | Fixed in 2.18.0 | 20 Oct 2026 |
| Moderate | ApostropheCMS sanitize-html: nonTextTags discard region ends early on an implied close, letting <noscript> content render CVE-2026-113654 | Fixed in 2.18.0 | 20 Oct 2026 |
| Moderate | ApostropheCMS: Mutation-XSS / allowedTags bypass via literal `</textarea/>` solidus close CVE-2026-63670 | Fixed in 2.17.6 | 3 Sep 2026 |
| Moderate | ApostropheCMS: Stored XSS via SVG SMIL URI-list scheme-policy bypass CVE-2026-84371 | Fixed in 2.17.7 | 1 Sep 2026 |
| Moderate | sanitize-html has incomplete URI scheme validation in that allows javascript: URIs through action, formaction, data, poster, and background attributes CVE-2026-53606 | Fixed in 2.17.5 | 31 Jul 2026 |
| Critical | Apostrophe has default XSS via `xmp` raw-text passthrough in `sanitize-html` CVE-2026-44990 | Fixed in 2.17.4 | 14 May 2026 |
| Moderate | sanitize-html allowedTags Bypass via Entity-Decoded Text in nonTextTags Elements CVE-2026-40186 | Fixed in 2.17.3 | 16 Apr 2026 |
| Moderate | sanitize-html is vulnerable to XSS through incomprehensive sanitization CVE-2019-25225 | Fixed in 2.0.0-beta | 8 Sep 2025 |
| Moderate | sanitize-html Information Exposure vulnerability CVE-2024-21501 | Fixed in 2.12.1 | 24 Feb 2024 |
| High | Sanitize-html Vulnerable To REDoS Attacks CVE-2022-25887 | Fixed in 2.7.1 | 31 Aug 2022 |
| Moderate | Improper Input Validation in sanitize-html CVE-2021-26540 | Fixed in 2.3.2 | 6 May 2021 |
| Moderate | Improper Input Validation in sanitize-html CVE-2021-26539 | Fixed in 2.3.1 | 6 May 2021 |
| Moderate | Cross-Site Scripting in sanitize-html CVE-2016-1000237 | Fixed in 1.4.3 | 16 Apr 2020 |
In the news
- Typescript-friendly library to sanitize HTML stackoverflow.com, 21 Jan 2025
- sanitize-html converts special character such as '&' to '&" stackoverflow.com, 26 Dec 2024
Sources: npm, deps.dev (CC BY 4.0), OSV. Last checked 4 Dec 2026.