Skip to content

fix(deps): update dependency sanitize-html to v2.18.2 - #716

Merged
renovate[bot] merged 1 commit into
mainfrom
renovate/sanitize-html-2.x
Nov 23, 2026
Merged

renovate[bot] merged 1 commit into
mainfrom
renovate/sanitize-html-2.x

Conversation

@renovate

@renovate renovate Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
sanitize-html (source) 2.17.0 → 2.18.2 age confidence

Release Notes

apostrophecms/apostrophe (sanitize-html)

v2.18.2

Compare Source

Fixes
  • With parser.decodeEntities: false, named entities longer than 20 characters, such as &CounterClockwiseContourIntegral;, are no longer double-encoded. Thanks to Kenny for the contribution.
Security
  • Outside SVG and MathML, browsers parse <![CDATA[ as a bogus comment that ends at the first >, but the underlying parser read it all the way to ]]>. Markup between those two points was hidden from sanitize-html, so a start tag for one of the nonTextTags (such as noscript, style, script, textarea or xmp) placed there was not seen, and content the browser would keep inert inside that element was emitted as live markup. Only tags, attributes and URL schemes permitted by the allowlist could be emitted this way. A <![CDATA[ section now always ends at the first >, as it does in HTML content in a browser. As a result, the text of a real CDATA section inside SVG or MathML is now dropped or sanitized as markup instead of being kept as text, and the literal sequence <![CDATA[ inside an allowed script or style element is written as <!&#&#8203;91;CDATA[ (CWE-79, CWE-436, GHSA-2rjc-9xvg-45j7).

    Thanks to Oscar Rodríguez for reporting the vulnerability.

  • The check that drops SVG animation elements (animate, animateColor, animateMotion, animateTransform, set) when they retarget a URL attribute such as href took only the part of attributeName after its last colon as the target. Browsers split a name with more than one colon differently, and current Chrome resolves a spelling such as xlink:href:x to xlink:href, so the animation was kept and could retarget a link to a javascript: URL after sanitization. Every colon-separated part of attributeName, and of the element name, is now matched. The default configuration is not affected: it only applies when animation elements are allowed together with attributeName and an animation value attribute such as values or to (CWE-79, CWE-184, GHSA-8g6g-w2rq-xcmc).

    Thanks to Zachariah Mithani for reporting the vulnerability.

  • When style was allowed, the content of a <style> element inside svg or math could be emitted as live markup, even when svg and math themselves were not allowed. The underlying parser and browsers do not always agree on whether such a <style> is an HTML element, whose content is raw CSS text, or an SVG/MathML element, whose content is markup: for example a <style> inside MathML annotation-xml without an HTML encoding is a MathML element to a browser but raw text to the parser, and inside svg or math the parser decodes &lt; in its content. Because sanitize-html emitted style content as is, markup that the allowlist never permitted, including event handler attributes, could reach the browser. Inside svg or math, a < in style content is now written as the equivalent CSS escape \3c , which means the same in a stylesheet and cannot open a tag. Other stylesheets are unchanged. Exposure is limited: style is not allowed by default, it is one of the vulnerableTags that sanitize-html warns about unless allowVulnerableTags is set, and allowing it already permits CSS-based attacks (CWE-79, GHSA-6wrv-5cp6-h3c5).

    Thanks to Ali Mustafa for reporting the vulnerability.

v2.18.1

Compare Source

Changes
  • Remove the deepmerge dependency, which was used only to combine tag-specific and * (all tags) entries in allowedClasses and allowedStyles. That is now done by a few lines of code within sanitize-html.

    This is not a fix for a vulnerability in sanitize-html. Security scanners such as Snyk now report CVE-2026-93753 in deepmerge, which can affect applications that merge untrusted objects, such as parsed JSON request bodies. sanitize-html only ever merged the developer's own configuration, never anything taken from the HTML being sanitized, so it was not exploitable through sanitize-html. Since we needed only a small part of what deepmerge does, we removed the dependency so that these reports no longer appear for sanitize-html users.

Security
  • Since 2.18.0, the fallback markup of a discarded <iframe> was re-sanitized by a recursive call with no limit, one level per nested unclosed <iframe>. A few kilobytes of crafted input could throw RangeError: Maximum call stack size exceeded with the default options, and the nestingLimit option was not enforced across the fallback because each nested call started counting from zero. The fallback of a discarded <iframe> is still sanitized and kept, but only up to eight nested <iframe> elements (deeper fallback is escaped as text, as before 2.18.0), and the current nesting depth now carries into the nested call so nestingLimit applies to the whole output. Only 2.18.0 was affected, and the exception is thrown synchronously, so applications that catch errors from sanitizeHtml only lost the affected request (CWE-674, GHSA-c9rx-x947-fp3h).

    Thanks to hkmj19, JohnBeckley, and amikhailovstiltsoft for reporting the vulnerability.

v2.18.0

Compare Source

Adds
  • Added a logger option: pass any console-shaped object, with debug, info, warn and error methods, and sanitize-html's own diagnostics are delivered to it rather than to the console, so an application with a logging pipeline of its own can route them. Missing methods, and no option at all, fall back to the console. Those messages also lost their decorative line breaks and warning icon, so each is now a single line of text; their wording is otherwise unchanged.
Fixes
  • allowedSchemesByTag is now applied to srcset and imagesrcset URLs. Previously the per-tag lookup used the attribute name instead of the tag name, so these attributes always fell back to the global allowedSchemes and ignored a tag-specific scheme allowlist. Thanks to
    spokodev for the fix.
  • Starting in version 2.17.6, sanitize-html began escaping any markup preserved inside a disallowed iframe tag, which was a change
    in behavior due to an upstream change in htmlparser2. This fix ensures such "fallback markup" is preserved without escaping, but also
    fully sanitized according to the same rules as the original input. Thanks to sumitjhacodes for
    the fix.
Security
  • When meta was allowed together with its http-equiv and content attributes, the destination URL of a <meta http-equiv="refresh" content="0;url=..."> was never checked against allowedSchemes, because it is embedded in content rather than being an attribute of its own. So javascript:, data: and other disallowed destinations passed through. The refresh URL is now extracted the way browsers do it, allowing for the different spellings, separators, quoting and letter case of url=, and checked against allowedSchemes (or allowedSchemesByTag.meta). If it is rejected, or the content cannot be parsed as a refresh, the content attribute is removed. content on other meta elements is unchanged. The default configuration does not allow meta and was not affected (CWE-79, CWE-601, GHSA-cv27-6wvh-8x7j).

    Thanks to adrbogacz for reporting the vulnerability.

  • When noscript is listed in nonTextTags, the discarded region could end too early. Browsers with scripting enabled treat <noscript> content as raw text up to the first </noscript>, but the underlying parser treats it as markup, so an end tag for an enclosing element inside <noscript> closed it implicitly and the rest of its content was emitted as ordinary sanitized markup. The discard region now continues until the point where a browser would end the <noscript> element, while implied closes of other nonTextTags such as <option> behave as before (CWE-79, CWE-436, GHSA-x3q4-9hxx-gx8m).

    Thanks to joaquiniglesiaslug for reporting the vulnerability.

  • The check that drops SVG animation elements (animate, animateColor, animateMotion, animateTransform, set) when they retarget a URL attribute such as href compared the full tag name, so a namespace-prefixed spelling like svg:animate was not recognized when such tags were allowed (for example with allowedTags: false). In XML serializations such as XHTML or standalone SVG, the prefixed element is a real animation element and could retarget a link to a javascript: URL after sanitization. The element and attributeName are now matched by their local names, ignoring any prefix (CWE-79, CWE-184, GHSA-374f-7chj-9948).

    Thanks to Kai Aizen (SnailSploit) for reporting the vulnerability.

v2.17.7

Compare Source

Security
  • Fixed an XSS / URL scheme policy bypass affecting configurations that allow the SVG animation elements (animate, animateColor, animateMotion, animateTransform or set) together with attributeName and one of the animation value attributes. The default configuration was not affected, as these elements are not in the default allowedTags. apostrophecms was not affected. Thanks to koyokr for responsibly disclosing the vulnerability (GHSA-g8qq-57p8-ggw5).

v2.17.6

Compare Source

Adds
  • Added a logger option: pass any console-shaped object, with debug, info, warn and error methods, and sanitize-html's own diagnostics are delivered to it rather than to the console, so an application with a logging pipeline of its own can route them. Missing methods, and no option at all, fall back to the console. Those messages also lost their decorative line breaks and warning icon, so each is now a single line of text; their wording is otherwise unchanged.
Fixes
  • allowedSchemesByTag is now applied to srcset and imagesrcset URLs. Previously the per-tag lookup used the attribute name instead of the tag name, so these attributes always fell back to the global allowedSchemes and ignored a tag-specific scheme allowlist. Thanks to
    spokodev for the fix.
  • Starting in version 2.17.6, sanitize-html began escaping any markup preserved inside a disallowed iframe tag, which was a change
    in behavior due to an upstream change in htmlparser2. This fix ensures such "fallback markup" is preserved without escaping, but also
    fully sanitized according to the same rules as the original input. Thanks to sumitjhacodes for
    the fix.
Security
  • When meta was allowed together with its http-equiv and content attributes, the destination URL of a <meta http-equiv="refresh" content="0;url=..."> was never checked against allowedSchemes, because it is embedded in content rather than being an attribute of its own. So javascript:, data: and other disallowed destinations passed through. The refresh URL is now extracted the way browsers do it, allowing for the different spellings, separators, quoting and letter case of url=, and checked against allowedSchemes (or allowedSchemesByTag.meta). If it is rejected, or the content cannot be parsed as a refresh, the content attribute is removed. content on other meta elements is unchanged. The default configuration does not allow meta and was not affected (CWE-79, CWE-601, GHSA-cv27-6wvh-8x7j).

    Thanks to adrbogacz for reporting the vulnerability.

  • When noscript is listed in nonTextTags, the discarded region could end too early. Browsers with scripting enabled treat <noscript> content as raw text up to the first </noscript>, but the underlying parser treats it as markup, so an end tag for an enclosing element inside <noscript> closed it implicitly and the rest of its content was emitted as ordinary sanitized markup. The discard region now continues until the point where a browser would end the <noscript> element, while implied closes of other nonTextTags such as <option> behave as before (CWE-79, CWE-436, GHSA-x3q4-9hxx-gx8m).

    Thanks to joaquiniglesiaslug for reporting the vulnerability.

  • The check that drops SVG animation elements (animate, animateColor, animateMotion, animateTransform, set) when they retarget a URL attribute such as href compared the full tag name, so a namespace-prefixed spelling like svg:animate was not recognized when such tags were allowed (for example with allowedTags: false). In XML serializations such as XHTML or standalone SVG, the prefixed element is a real animation element and could retarget a link to a javascript: URL after sanitization. The element and attributeName are now matched by their local names, ignoring any prefix (CWE-79, CWE-184, GHSA-374f-7chj-9948).

    Thanks to Kai Aizen (SnailSploit) for reporting the vulnerability.

v2.17.5

Compare Source

Security
  • Added a number of new attributes to be protected against unsafe URLs, e.g. javascript: and similar. None of these are used in the default configuration of sanitize-html or apostrophe or likely to be used there, and some attributes, like an action for a form, are inherently unsafe to allow if XSS protection is your goal. Nevertheless it makes sense to block certain URL types where they are not appropriate. Some attributes are not supported at all by modern browsers but are included for completeness. Thanks to crattack for reporting the vulnerability.
  • Address a potential vulnerability when nonTextTags is configured in a nonstandard way. While it is never a good idea to remove known non-text tags from the standard list e.g. script, styles, etc., this change ensures that doing so does not result in nested tags being passed through without sanitization when they are not expressly allowed. (ApostropheCMS would never trigger this situation.) Thanks to Dipanshu singh for pointing out the issue and contributing the fix.

v2.17.4

Compare Source

Changes
  • sanitize-html and launder now share a single implementation of naughtyHref, based on that which previously existed in sanitize-html.
Security
  • Security vulnerability: the xmp tag could be used to pass forbidden markup through sanitize-html, even when xmp itself is not explicitly allowed All users of sanitize-html should update immediately. Thanks to Vincenzo Turturro for reporting the vulnerability.

v2.17.3

Compare Source

Security
  • Fix vulnerability introduced in version 2.17.2 that allowed XSS attacks if the developer chose to permit option tags. There was no vulnerability when not explicitly allowing option tags.

v2.17.2

Compare Source

Changes
  • Upgrade htmlparser2 from 8.x to 10.1.0. This improves security by correctly decoding zero-padded numeric character references (e.g., &#&#8203;0000001) that previously bypassed javascript: URL detection. Also fixes double-encoding of entities inside raw text elements like textarea and option.

v2.17.1

Compare Source

Fixes
  • Fix unclosed tags (e.g., <hello) returning empty string in escape and recursiveEscape modes. Fixes #​706.
    Thanks to Byeong Hyeon for the fix.

Configuration

📅 Schedule: (UTC)

  • Branch creation
    • Only on Sunday and Saturday (* * * * 0,6)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Enabled.

♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate
renovate Bot requested a review from a team as a code owner October 18, 2026 22:30
@renovate renovate Bot added the renovate label Oct 18, 2026
renovate-approve-2[bot]
renovate-approve-2 Bot previously approved these changes Oct 18, 2026
renovate-approve[bot]
renovate-approve Bot previously approved these changes Oct 18, 2026
@socket-security

socket-security Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedsanitize-html@​2.17.0 ⏵ 2.18.2100 +1100 +11100 +192100

View full report

@renovate
renovate Bot force-pushed the renovate/sanitize-html-2.x branch from 39f9038 to a2e3b8e Compare October 20, 2026 15:54
renovate-approve-2[bot]
renovate-approve-2 Bot previously approved these changes Oct 20, 2026
renovate-approve[bot]
renovate-approve Bot previously approved these changes Oct 20, 2026
@renovate
renovate Bot force-pushed the renovate/sanitize-html-2.x branch from a2e3b8e to a453bdf Compare October 21, 2026 21:28
@renovate renovate Bot changed the title fix(deps): update dependency sanitize-html to v2.18.0 fix(deps): update dependency sanitize-html to v2.18.1 Oct 21, 2026
renovate-approve-2[bot]
renovate-approve-2 Bot previously approved these changes Oct 21, 2026
renovate-approve[bot]
renovate-approve Bot previously approved these changes Oct 21, 2026
@renovate
renovate Bot force-pushed the renovate/sanitize-html-2.x branch from a453bdf to 80d0334 Compare October 26, 2026 20:10
renovate-approve[bot]
renovate-approve Bot previously approved these changes Oct 26, 2026
renovate-approve-2[bot]
renovate-approve-2 Bot previously approved these changes Oct 26, 2026
@renovate
renovate Bot force-pushed the renovate/sanitize-html-2.x branch from 80d0334 to 93434f9 Compare November 6, 2026 01:49
renovate-approve-2[bot]
renovate-approve-2 Bot previously approved these changes Nov 6, 2026
renovate-approve[bot]
renovate-approve Bot previously approved these changes Nov 6, 2026
@renovate
renovate Bot force-pushed the renovate/sanitize-html-2.x branch 2 times, most recently from a4d707f to 9705587 Compare November 16, 2026 21:09
@renovate
renovate Bot force-pushed the renovate/sanitize-html-2.x branch from 9705587 to 4a3d080 Compare November 18, 2026 22:19
@renovate renovate Bot changed the title fix(deps): update dependency sanitize-html to v2.18.1 fix(deps): update dependency sanitize-html to v2.18.2 Nov 18, 2026
renovate-approve-2[bot]
renovate-approve-2 Bot previously approved these changes Nov 18, 2026
renovate-approve[bot]
renovate-approve Bot previously approved these changes Nov 18, 2026
@renovate
renovate Bot force-pushed the renovate/sanitize-html-2.x branch from 4a3d080 to afa2e7e Compare November 23, 2026 06:21
@renovate
renovate Bot merged commit 2e5ba62 into main Nov 23, 2026
3 checks passed
@renovate
renovate Bot deleted the renovate/sanitize-html-2.x branch November 23, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants