Update npm package sanitize-html to v2.17.5 [SECURITY] - #9136
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
PR SummaryLow Risk Overview This is a security patch for CVE-2026-53606: scheme checks for dangerous URIs (e.g. Reviewed by Cursor Bugbot for commit 8728ee8. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0de0ed5. Configure here.
Renovate bumped package.json without updating the lockfile, breaking the immutable install in CI. Regenerated via yarn install and verified with yarn dedupe --strategy highest --check (no packages to dedupe). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WfQz9Y36mQ8J6kRC3zaEtt
…ability' into wt/9136
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9136 +/- ##
=======================================
Coverage 59.58% 59.58%
=======================================
Files 1410 1410
Lines 137980 137977 -3
Branches 6494 6494
=======================================
+ Hits 82210 82212 +2
+ Misses 54734 54729 -5
Partials 1036 1036
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Edited/Blocked NotificationRenovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR. You can manually request rebase by checking the rebase/retry box above. |

This PR contains the following updates:
2.17.4→2.17.5sanitize-html has incomplete URI scheme validation in that allows javascript: URIs through action, formaction, data, poster, and background attributes
CVE-2026-53606 / GHSA-vccv-cmxp-4j9h
More information
Details
Summary
sanitize-html uses
allowedSchemesAppliedToAttributes(default:['href', 'src', 'cite']) to gate thenaughtyHref()function that blocks dangerous URI schemes likejavascript:andvbscript:. The HTML specification defines 10+ attributes that accept URIs (action,formaction,data,poster,background,ping,xlink:href,dynsrc,lowsrc), but none of these are included in the default gate list. When a developer allows any of these attributes in their configuration,javascript:URIs pass through completely unmodified, enabling XSS.The library has zero awareness of these URI-bearing attributes — none appear anywhere in the 854-line source file (verified by grep). No warning mechanism exists, and the README provides no security guidance about expanding
allowedSchemesAppliedToAttributeswhen allowing form or media attributes.Severity
Exploitation requires non-default configuration: the developer must explicitly allow a non-default tag (e.g.,
form) AND a non-default attribute (e.g.,action). Default configuration is NOT vulnerable. However, this is a common configuration pattern for CMS platforms, form builders, and rich content editors.Affected Versions
All versions of sanitize-html from v1.18.0 (which introduced
allowedSchemesAppliedToAttributes) through at least v2.17.2. The default list has been['href', 'src', 'cite']since introduction and has never been expanded.Root Cause
File:
index.js:329(sanitize-html 2.10.0, confirmed same in 2.17.x)Default list at line 829:
The
naughtyHref()function (lines 627-667) correctly blocksjavascript:,vbscript:, and other dangerous schemes. However, it has exactly 2 call sites in the entire codebase (lines 330 and 395), both inside theindexOfgate. There is no ungated path.When attribute name is
action,formaction,data,poster,background, etc.:indexOf('action')returns-1ifblock is skipped entirelynaughtyHref()is never calledjavascript:alert(1)passes through unmodifiedThe
escapeHtml()function at line 464 provides no defense — it only encodes& < > "characters, which are not present injavascript:alert(1).Data Flow:
Steps to Reproduce
Observed behavior:
javascript:preserved onaction/formaction/databut correctly stripped onhref.Expected behavior:
javascript:should be stripped on ALL URI-bearing attributes, or at minimum, the library should warn developers when they allow URI-bearing attributes not covered by scheme validation.Impact
An attacker can achieve XSS in applications that use sanitize-html with non-default configurations allowing URI-bearing attributes:
<form action="javascript:...">— XSS on form submission (all modern browsers)<button formaction="javascript:...">— per-button XSS override (all modern browsers)<object data="javascript:...">— object load XSS (Chrome, Firefox)<video poster="javascript:...">— limited browser support but spec-validCommon vulnerable configurations:
Mitigating factors:
form-actiondirective mitigates form-based vectorsallowedSchemesAppliedToAttributesRemediation
Option 1 (Recommended): Expand the default
allowedSchemesAppliedToAttributeslist:Option 2: Apply
naughtyHref()to ALL attributes by default (invert the gate logic).Option 3: Add a runtime warning when developers allow URI-bearing attributes not in
allowedSchemesAppliedToAttributes(analogous tovulnerableTagswarning forscript/styleat lines 124-129).Reporter
Kevin Lee (Changseon Lee)
OPCIA Corp. / PeanutAI Inc.
Seoul, South Korea
GitHub: crattack
Severity
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
apostrophecms/apostrophe (sanitize-html)
v2.17.5Compare Source
Security
javascript:and similar. None of these are used in the default configuration ofsanitize-htmlorapostropheor likely to be used there, and some attributes, like anactionfor aform, 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.Configuration
📅 Schedule: (UTC)
🚦 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.
This PR has been generated by Mend Renovate.