Repository navigation
Conversation
|
See #235 (comment). |
|
Hi, thanks for working on this fix for CVE-2026-112366. Is there a rough timeline for merging this and cutting a release? Every published version up to 4.0.7 is still flagged, so for now we’re applying this change as a local patch. Could the fix also be released for the 2.x line? anymatch, micromatch, and readdirp still depend on picomatch@^2, so a 4.x release alone won’t reach most installs. |
在 npm 原版 4.0.7 上回移 Eduardo Seibt 的解析器变更。将修复包、MIT 许可证、来源补丁与完整性摘要固定在前端开发依赖中。Vite、Vitest、tinyglobby 和 fdir 均解析到同一修复包。 Source-PR: micromatch/picomatch#237 Original-Commit: 1bf0d04563cb9ce568cf36efc5f6b7187d9911d5 Co-Authored-By: Codex (GPT-6.2 Sol) <[email protected]>
Upstream micromatch#237 collapses +(P) to (P) for any single star branch. That changes results when P can match a slash or is not a glob star (Devin Review on #1): +(*\/) on a/b/, +("*") on **, +([ab]*c) with regex:true on acbc, and +(*[/]) / +(*[[:punct:]]) / +(*[.-0]) on x//. Skip the collapse in exactly those cases (escaped slash, quotes, regex mode, a bracket that can match /), keeping 4.0.7's output for them. Generated differential against 4.0.7: 0 mismatches. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix: CVE-2026-112366, publish @moonaan/picomatch 4.0.8-moonaan.1 (4.0.7 + upstream micromatch#237)
|
Disclosure: this analysis was prepared with an AI assistant (Claude). Every measurement below was actually run and can be reproduced with the snippets given. Setup: PR head 1bf0d04 checked out detached, base master 9fab7bf, Node 24.22.3 on macOS arm64. The timing input is A run confirms the single-branch collapse from the comment above. With n=200, Two inputs change their result relative to master: const pm = require('picomatch');
// 1. A quoted star is literal, but the branch is still collapsed:
pm.makeRe('+("*a")').source; // '^(?:(?=.)(?:\\*a))$'
pm.isMatch('*a*a', '+("*a")'); // false on this branch, true on master
pm.isMatch('*a*a', '+("*a")', { maxExtglobRecursion: false }); // true
// 2. [[:punct:]] contains "/", so the star can no longer absorb the repetition:
pm.isMatch('a/b/', '+(*[[:punct:]])'); // false on this branch, true on master
pm.isMatch('a/b/', '+(*[[:punct:]])', { maxExtglobRecursion: false }); // true
The collapse is only equivalent when every
Equivalence check. I compared
That is 57,330 comparisons, with no differences. The two cases above are not in this set, because it has no quotes and no brackets. With Still exponential on this branch at n=28: |
|
Both GitHub and VulnCheck have withdrawn this advisory, as it is not a security issue. If a tool is still reporting you're "vulnerable", then you need to contact the tool author about getting their source updated. |
Summary
Fixes GHSA-fc5q-39xc-vjpf / CVE-2026-112366.
analyzeRepeatedExtglobskipped single-branch repeated extglobs such as+(*)or+(*a), so they compiled to nested unbounded quantifiers (e.g.(?:[^/]*?a)+), causing exponential backtracking on short inputs.Fix
A single branch containing a top-level
*(with no/, groups, alternation, nested extglobs or globstar) absorbs its own repetition, so:+(P)→(?:P)*(P)→(?:P)?These are semantically equivalent and remove the nested quantifier. Other cases keep the existing risky-extglob handling. The rewrite is skipped when
maxExtglobRecursion: false.+(*a)(?:[^/]*?a)+(?:[^/]*?a)*(*a)(?:[^/]*?a)*(?:[^/]*?a)?Before the fix, matching
'a'.repeat(24) + 'b'against+(*a)took ~107ms and doubled with each extra char. With the fix it takes ~0ms.Tests
Added cases in
test/options.maxExtglobRecursion.jscovering:+(*)c,+(*a),+(a*b),*(*.js))All 1999 tests pass.