Skip to content

chore(deps): update dependency sanitize-html (minor) [security]#23179

Merged
charliedowler merged 1 commit into
mainfrom
renovate/npm-sanitize-html-vulnerability
May 18, 2026
Merged

chore(deps): update dependency sanitize-html (minor) [security]#23179
charliedowler merged 1 commit into
mainfrom
renovate/npm-sanitize-html-vulnerability

Conversation

@lightdash-renovate-bot
Copy link
Copy Markdown
Contributor

@lightdash-renovate-bot lightdash-renovate-bot Bot commented May 16, 2026

This PR contains the following updates:

Package Change Age Confidence
sanitize-html (source) 2.12.12.17.4 age confidence

Warning

Some dependencies could not be looked up. Check the Dependency Dashboard for more information.


Apostrophe has default XSS via xmp raw-text passthrough in sanitize-html

CVE-2026-44990 / GHSA-rpr9-rxv7-x643

More information

Details

Summary

Under the default configuration, sanitize-html can turn attacker-controlled content inside a disallowed xmp element into live HTML or JavaScript. This is a sanitizer bypass in the default disallowedTagsMode: 'discard' path and can lead to stored XSS in applications that render sanitized output back to users.

Details

In sanitize-html@2.17.3, the default nonTextTags list includes only script, style, textarea, and option in index.js lines 138-142. That means disallowed xmp tags are not treated as "drop the entire contents" tags.

Later, in the ontext handler at index.js lines 569-577, the code special-cases textarea and xmp and appends their text content directly to the output without escaping:

} else if ((options.disallowedTagsMode === 'discard' || options.disallowedTagsMode === 'completelyDiscard') && (tag === 'textarea' || tag === 'xmp')) {
  result += text;
}

Because htmlparser2 treats xmp as a raw-text element, markup inside xmp is parsed as text on input but becomes live markup again once it is appended unescaped to the sanitized output.

This creates a default sanitizer bypass. For example, a disallowed <xmp> wrapper can be used to smuggle <script> or event-handler payloads through sanitization.

The README also appears to contradict the implementation. In the "Discarding the entire contents of a disallowed tag" section, the documented exception list names only style, script, textarea, and option, and does not mention xmp.

PoC

Tested locally against sanitize-html@2.17.3 on Node.js v25.2.1.

  1. Install the package:
npm install sanitize-html
  1. Run the following script:
const sanitizeHtml = require('sanitize-html');

console.log(sanitizeHtml('<xmp><script>alert(1)</script></xmp>'));
console.log(sanitizeHtml('<xmp><img src=x onerror=alert(1)></xmp>'));
console.log(sanitizeHtml('<xmp><svg><script>alert(1)</script></svg></xmp>'));
  1. Observed output:
<script>alert(1)</script>
<img src=x onerror=alert(1)>
<svg><script>alert(1)</script></svg>
  1. Render any of the returned strings in a browser context that trusts sanitize-html output, for example:
const dirty = '<xmp><script>alert(1)</script></xmp>';
const clean = sanitizeHtml(dirty);

If clean is inserted into the DOM or stored and later rendered as trusted HTML, the attacker-controlled script executes.

Impact

This is a cross-site scripting vulnerability in the default sanitizer behavior. Any application that uses sanitize-html defaults and then renders the returned HTML as trusted output is impacted. A remote attacker who can submit HTML content can trigger execution of arbitrary JavaScript in another user's browser when that content is viewed.

Severity

  • CVSS Score: 9.3 / 10 (Critical)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Release Notes

apostrophecms/apostrophe (sanitize-html)

v2.17.4

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.

v2.17.0

Compare Source

  • Add preserveEscapedAttributes, allowing attributes on escaped disallowed tags to be retained. Thanks to Ben Elliot for this new option.

v2.16.0

Compare Source

  • Add onOpenTag and onCloseTag events to enable advanced filtering to hook into the parser. Thanks to Rimvydas Naktinis.

v2.15.0

Compare Source

  • Allow keeping tag content when discarding with exclusive filter by returning "excludeTag". Thanks to rChaoz.

v2.14.0

Compare Source

  • Fix adding text with transformTags in cases where it originally had no text child elements. Thanks to f0x.

v2.13.1

Compare Source

  • Fix to allow regex in allowedClasses wildcard whitelist. Thanks to anak-dev.

v2.13.0

Compare Source

  • Documentation update regarding minimum supported TypeScript version.

  • Added disallowedTagsMode: completelyDiscard option to remove the content also in HTML. Thanks to Gauav Kumar for this addition.


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

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 has been generated by Mend Renovate.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 16, 2026

🧪 Test Selection

✅ Tests that will run

Test Description
Frontend E2E Tests Runs Cypress app tests
Backend API Tests Runs Vitest API tests
CLI Tests Runs CLI integration and dbt version tests

⏭️ Tests skipped (no relevant file changes detected)

Test How to trigger manually
Preview Environment Add deploy-preview to PR description
Timezone Tests Add test-timezone to PR description

Tip: Add test-all to your PR description to run all tests.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 16, 2026

Your preview environment pr-23179 has been deployed.

Preview environment endpoints are available at:

@lightdash-renovate-bot lightdash-renovate-bot Bot force-pushed the renovate/npm-sanitize-html-vulnerability branch from 1bfcf52 to 8185477 Compare May 16, 2026 14:59
@socket-security
Copy link
Copy Markdown

socket-security Bot commented May 16, 2026

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

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedsanitize-html@​2.17.410010010093100

View full report

@github-actions
Copy link
Copy Markdown

Preview Environment

🌐 URL: https://lightdash-preview-pr-23179.lightdash.okteto.dev

📋 Logs: View in GCP Console

🔧 SSH: ./scripts/okteto-ssh.sh 23179

@lightdash-renovate-bot lightdash-renovate-bot Bot force-pushed the renovate/npm-sanitize-html-vulnerability branch 5 times, most recently from 3eee399 to c3c4526 Compare May 18, 2026 13:51
@charliedowler charliedowler force-pushed the renovate/npm-sanitize-html-vulnerability branch from c3c4526 to bfca2d9 Compare May 18, 2026 16:51
@charliedowler charliedowler merged commit 8f27ce3 into main May 18, 2026
16 of 17 checks passed
@charliedowler charliedowler deleted the renovate/npm-sanitize-html-vulnerability branch May 18, 2026 16:56
@lightdash-bot
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 0.2966.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants