Override transitive linkify-it to 5.0.2 to remediate mailto DoS - #2693
Draft
jainakanksha-msft with Copilot wants to merge 2 commits into
Draft
Override transitive linkify-it to 5.0.2 to remediate mailto DoS#2693jainakanksha-msft with Copilot wants to merge 2 commits into
linkify-it to 5.0.2 to remediate mailto DoS#2693jainakanksha-msft with Copilot wants to merge 2 commits into
Conversation
Copilot
AI
changed the title
[WIP] Fix DoS vulnerability in linkify-it mailto validator
Override transitive Aug 3, 2026
linkify-it to 5.0.2 to remediate mailto DoS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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...