Override transitive linkify-it to 5.0.2 to remediate mailto DoS - #2693
Override transitive linkify-it to 5.0.2 to remediate mailto DoS#2693jainakanksha-msft with Copilot wants to merge 4 commits into
linkify-it to 5.0.2 to remediate mailto DoS#2693Conversation
linkify-it to 5.0.2 to remediate mailto DoS
|
@copilot , 1. rebase the branch with main |
|
@copilot, 1. rebase the branch with main |
There was a problem hiding this comment.
Pull request overview
Pins a vulnerable transitive dependency (linkify-it) to a patched version via npm overrides, and updates the lockfile to ensure the resolved dependency graph no longer includes the vulnerable release. This targets a DoS vulnerability that is only expected to be reachable in dev/CI packaging flows (via vsce).
Changes:
- Added an npm
overridesentry to forcelinkify-itto5.0.2. - Regenerated
package-lock.jsonto resolvelinkify-itto5.0.2(and update its transitiveuc.micro).
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| package.json | Adds an override to pin transitive linkify-it to 5.0.2. |
| package-lock.json | Updates resolved dependency graph to remove linkify-it@3.0.3 and lock linkify-it@5.0.2. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "overrides": { | ||
| "undici": "^7.28.0" | ||
| "undici": "^7.28.0", | ||
| "linkify-it": "5.0.2" | ||
| }, |
|
…ity without override Co-authored-by: jainakanksha-msft <181211853+jainakanksha-msft@users.noreply.github.com>
Upgraded the dev dependency Validation performed:
This fully replaces the override approach from the original PR with an actual dependency upgrade, per your request. |
|
@copilot resolve the merge conflicts in this pull request |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (2)
package.json:94
- PR title/description state that an npm override pins transitive
linkify-itto 5.0.2, but the committedoverridesblock only containsundici. If the intent is still to enforce the patchedlinkify-itversion via override (rather than relying solely on the@vscode/vsceupgrade + lockfile), add thelinkify-itoverride here so future lock regenerations can’t reintroduce a vulnerable version.
"overrides": {
"undici": "^7.28.0"
},
ChangeLog.md:19
- This changelog entry says the remediation happened “without requiring a version override”, but the PR title/description describe remediation via an npm override. Consider removing this clause to keep the changelog accurate regardless of whether the override approach is used.
- Upgraded the dev dependency `vsce` (deprecated) to `@vscode/vsce` 3.9.2, which resolves `markdown-it` to 14.x and `linkify-it` to 5.0.2, remediating a mailto DoS vulnerability (`GHSA-v245-v573-v5vm` / `CVE-2026-59887`) without requiring a version override.
|
@copilot resolve the merge conflicts in this pull request |
Rebased onto latest I also revalidated the dependency goal after conflict resolution:
Note: |
|
@copilot, please take care of the main failure in this PR itself. |
linkify-itis vulnerable to quadratic-time processing on attacker-controlledmailto:input (GHSA-v245-v573-v5vm/CVE-2026-59887). In this repo it is only introduced transitively through the VS Code packaging toolchain, but the resolved version inpackage-lock.jsonwas still vulnerable.What changed
package.jsonto pin transitivelinkify-itto the lowest patched version:5.0.2package-lock.jsonso the resolved dependency graph no longer includeslinkify-it@3.0.3Why this path
linkify-itis not a direct dependency herevsce -> markdown-it -> linkify-itReachability Assessment
markdown-it,linkify-it, orlinkify: trueusage undersrc/ortests/vsceResult
linkify-itto a non-vulnerable version while preserving the existingvsce/markdown-itdependency chain{ "overrides": { "undici": "^7.28.0", "linkify-it": "5.0.2" } }Original prompt
This section details the Dependabot vulnerability alert you should resolve
<alert_title>linkify-it: Quadratic-complexity DoS via the
mailto:validator scan-loop on attacker text</alert_title><alert_description>### Summary
linkify-it's schema-scan loop (.test()/.match(), the documented public API) invokes themailto:schema validator at every
mailto:occurrence in the input text. For each occurrence the validator doestext.slice(pos)(an O(n) copy) and runs an email regex whose local-part classsrc_email_namegreedilyscans the entire remaining tail (O(n)) before failing. With N
mailto:occurrences that isN × O(n) = O(n²). Because linkify-it runs on arbitrary user text (markdown-it feeds it whole documents
when
linkify:true), an unauthenticated attacker can block the single-threaded event loop for many secondswith a small input. No length bound (unlike an HTTP header).
Root cause —
index.mjs+lib/re.mjsThe
while ((m = re.exec(text)) !== null) { …testSchemaAt… }scan loop calls the validator at eachmailto:hit;src_email_namegreedily consumes the whole tail (all chars are in its class) then fails forlack of
@.http:/https:do NOT blow up — their validator requires the tail to start with//, failingin O(1) per hit.
Proof of Concept (confirmed, linkify-it 5.0.1, Node v24)
mailto:contiguousmailto:space-separatedhttp://contiguous×~4 per 2× input ⇒ O(n²); equal-byte controls stay flat ⇒ algorithmic, not a GC/allocation artifact.

Real-world via markdown-it 14.x (
{linkify:true}),md.render('mailto:'.repeat(n)): 219 KB ≈ ~5 s.Impact
Reachable on arbitrary user text via the documented
.test()/.match()API and through markdown-it'slinkifier — comment systems, chat, forums, wikis, note apps that render user markdown with linkify enabled.
A ~220 KB post hangs the event loop ~5 s; a few hundred KB → tens of seconds. Availability only.
Suggested remediation
Bound the email local-part per RFC 5321 (≤64) so per-hit work is O(1), and avoid the full-tail slice:
Affected / disclosure
All versions through 5.0.1 (latest); same code on
master. cve-mcp/OSV report no known vulnerability forlinkify-it. Distinct from markdown-it's own
*-run ReDoS (CVE-2026-2327, different package/path) and therecent markdown-it DoS. Reported privately; happy to test a patch against the PoC.</alert_description>
high
https://github.com/markdown-it/linkify-it/security/advisories/GHSA-v245-v573-v5vm https://nvd.nist.gov/vuln/detail/CVE-2026-59887 https://github.com/markdown-it/linkify-it/commit/105e5d77f7d119871d2b2d86ed208568eb3e7ffe https://github.com/markdown-it/linkify-it/releases/tag/5.0.2 https://github.com/advisories/GHSA-v245-v573-v5vmGHSA-v245-v573-v5vm, CVE-2026-59887
linkify-it
npm
<vulnerable_versions>3.0.3</vulnerable_versions>
<patched_version>5.0.2</patched_version>
<manifest_path>package-lock.json</manifest_path>
<agent_instructions>@copilot please go through the issues mentioned here, identify all issues, and assess whether they can be fixed.
Recommend the necessary changes.
If it is not a breaking change, let's log the issue.
Please verify all test cases and validate the runs.
</agent_instructions>
<task_instructions>Resolve this alert by updating the affected package to a non-vulnerable version. Prefer the lowest non-vulnerable version (see the patched_version field above) over the latest to minimize breaking changes. Include a Reachabili...