minimatch: Quadratic compile time for long wildcard patterns (regression in 11.0.0 `mergeRows`)
Published 1 Dec 2026 · Updated 1 Dec 2026
Affected package
- Affected
- >=11.0.0 <11.0.7
- Fixed in
- 11.0.7
npm install minimatch@11.0.7Which minimatch does your project really install?
Works for private projects: the file is read in memory to run the scan and then dropped. Also reads yarn.lock, pnpm-lock.yaml or package.json.
Public repo?
Look after several JavaScript apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Details
Summary. mergeRows() (src/index.ts ~813-852, introduced in 2e1d896) iterates every part position and, for each row with a wildcard there, copies and joins the whole row to build a Map key. For a pattern made of many wildcard-only path parts this is quadratic in the number of parts, even with a single row. It runs in new Minimatch, so any uncached pattern pays it.
Measured on 11.0.6 with a pattern of * parts joined by /: 1000 parts 22 ms, 2000 parts 72 ms, 4000 parts 190 ms, 8000 parts 805 ms (about 4× per doubling). Extrapolated to the 64 KB pattern limit (~32,000 parts), one compile blocks for roughly 13 s. A leading brace group of distinct words multiplies the rows and the cost.
Suggested fix. Build merge keys incrementally (or hash per position) instead of joining the full row at each position, or skip merging when there is only one row; and count the work against braceExpandMax or a new limit.
Is GHSA-cf2h-pxjq-68xw in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected minimatch, and gives you the command that fixes it.
More advisories for minimatch
- MediumCVE-2026-140006minimatch: minimatch.escape() output matches more or less than the literal input · 1 Dec 2026
- MediumCVE-2026-140007minimatch: Global pattern cache retains large expansions, enabling memory exhaustion · 1 Dec 2026
- MediumCVE-2026-118764minimatch has potential denial of service via globparts amplification · 30 Oct 2026
- HighCVE-2026-27903minimatch has ReDoS: matchOne() combinatorial backtracking via multiple non-adjacent GLOBSTAR segments · 26 Feb 2026
- HighCVE-2026-27904minimatch ReDoS: nested *() extglobs generate catastrophically backtracking regular expressions · 26 Feb 2026
- HighCVE-2026-26996minimatch has a ReDoS via repeated wildcards with non-matching literal in pattern · 18 Feb 2026
References
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.