Repository navigation
chore: update dependency minimatch to v11 [security] - #2616
Draft
renovate[bot] wants to merge 1 commit into
Draft
renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
renovate
Bot
force-pushed
the
renovate/npm-minimatch-vulnerability
branch
4 times, most recently
from
November 13, 2026 04:05
3e8e1a6 to
a90e997
Compare
renovate
Bot
force-pushed
the
renovate/npm-minimatch-vulnerability
branch
3 times, most recently
from
November 23, 2026 05:10
2fa131c to
e0637d2
Compare
renovate
Bot
force-pushed
the
renovate/npm-minimatch-vulnerability
branch
from
November 30, 2026 20:25
e0637d2 to
cfbc1f3
Compare
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
renovate
Bot
force-pushed
the
renovate/npm-minimatch-vulnerability
branch
from
December 2, 2026 20:25
cfbc1f3 to
eb1b930
Compare
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.
This PR contains the following updates:
^10.2.6→^11.0.0minimatch has potential denial of service via globparts amplification
CVE-2026-118764 / GHSA-g3hv-75wg-m249
More information
Details
minimatch 10.2.6 contains an attacker-controlled pattern amplification in firstPhasePreProcess() when optimizationLevel >= 2.
researcher: Reid Downing (b1nv0id)
files:
issue:
input-controlled growth of globParts during first-phase preprocessing, followed by quadratic second-phase processing.
the **/../ transformation clones a globparts entry and appends the clone to the same globparts array:
this occurs inside a do...while (didSomething) fixpoint loop, allowing generated entries to be processed again.
the expanded globparts array is subsequently processed by secondPhasePreProcess(), which performs pairwise comparisons:
an attacker who can supply a glob pattern can therefore cause additional pattern entries to be generated during preprocessing, followed by quadratic pairwise processing, resulting in excessive cpu and memory consumption.
Severity
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
minimatch: minimatch.escape() output matches more or less than the literal input
CVE-2026-140006 / GHSA-c859-jr93-m5j4
More information
Details
Summary
minimatch.escape()is documented to "Escape all magic characters in a glob pattern, so that it will only ever match literal strings." (README, sectionminimatch.escape(pattern, options = {})). In minimatch 11.0.5 (latest release;mainis at thev11.0.5tag, commitea0a4a6) four classes of input break that contract:!is left unescaped.escape('!secret.txt')returns'!secret.txt', which is a negated pattern. It matches every path exceptsecret.txt, for examplepasswd. This holds in POSIX mode and inwindowsPathsNoEscapemode.#is left unescaped.escape('#notes.md')returns'#notes.md', which is a comment pattern. It matches nothing, including#notes.md. This holds in both modes.x\*(x, backslash, star),escape()returnsx\\\*. Alone, that pattern matches only the literal. When the pattern also contains a brace group, brace-expansion turns\\back into a single\, so the*becomes a live wildcard. The brace group can come from the caller (escape(u) + '.{js,ts}') or, with default options, from the user text itself (escape('x\\*{,}')).{ windowsPathsNoEscape: true, magicalBraces: true },escape('x{a,b}')returnsx[{]a,b[}]. Brace-expansion does not know[...]classes and expands it tox[]a]andx[b[]. The pattern matchesxaand does not matchx{a,b}.The README documents negation and comments for patterns in general (README lines 484-493). The
escape()section does not mention them, and its contract ("only ever match literal strings") is what callers rely on. The README warns that building a matcher from untrusted user patterns is unsafe.escape()is the documented way to make text match only as a literal (README.md:213-214), which is how callers embed untrusted text. These cases are inside that boundary. Behaviors 1 and 3 widen a match (fail open for an allowlist). Behavior 2 empties a match (fail open for a denylist or ignore list). Behavior 4 does both.Details
All line numbers refer to tag
v11.0.5. brace-expansion line numbers refer to brace-expansion 5.0.12, the version installed under^5.0.12at test time, filedist/commonjs/index.js.Behavior 1: leading
!.src/escape.ts:22-24: the comment states that!needs no escaping because the parens that make extglobs magic are escaped. That is true for!(...). It ignores pattern-level negation.src/escape.ts:25-32: none of the four branches escapes!. They escape?*()[], plus\in POSIX mode and{}withmagicalBraces. A leading!passes through.src/index.ts:1360-1374(parseNegate, called frommake()atsrc/index.ts:730): every leading!togglesthis.negateand is stripped.match()then inverts the result.\!is already a supported way to write a literal!.test/patterns.js:260has the entry['!\\!a*', ['a!b', 'd', 'e', '\\!a']], which excludes!aband!abc. The POSIX part of the fix uses that existing syntax, andunescape()already reverses it.test/escape-has-magic.jschecks theunescape()round trip andhasMagic() === falsefor every entry intest/patterns.js. That list includes'!a*'(line 251),'!\\!a*'(line 260) and'# ignore this'(line 327). The test never checksnegateorcomment. A negated literal pattern reportshasMagic() === false, so the suite passes. Measured on 11.0.5 with the port described under Suggested fix: 811 of 811 upstream assertions pass, and 6 of 784 addednegate/commentassertions fail ('!a*','!\\!a*'and'# ignore this', each in POSIX and Windows mode).Behavior 2: leading
#.src/escape.ts:25-32: no branch handles#.src/index.ts:118-120(minimatch()shortcut) andsrc/index.ts:719-722(make()): a pattern whose first character is#is a comment.minimatch()returnsfalseandMinimatchbuilds an empty set.Behavior 3: escaped backslash collapsed by brace expansion.
src/escape.ts:28andsrc/escape.ts:32: a literal\is escaped as\\and a literal*as\*. The user textx\*becomesx\\\*.src/index.ts:733calls#expandBraces(), which reachesbraceExpand()atsrc/index.ts:243-257. When the pattern contains any{...}group,src/index.ts:256passes the whole pattern to brace-expansionexpand().index.js:16(slashPattern = /\\\\/g) andindex.js:54-61(escapeBraces) replace each\\pair with a sentinel.index.js:62-69(unescapeBraces, applied to every result atindex.js:125) turns that sentinel into one\(line 64).x\\\*.{js,ts}therefore expands tox\\*.jsandx\\*.ts. In minimatch syntax that is an escaped backslash followed by a live*.escape()leaves{and}as they are (see the related note below). The user text can then supply the brace group, and the caller appends nothing:escape('x\\*{,}')returnsx\\\*{,}, which expands tox\\*twice and matchesx\anything. Commit 0d27f1c, which addedmagicalBracestoescape(), states that it resolves #234. Neither that commit nor its tests cover braces that turn an escaped*into a wildcard. Its tests intest/escape-has-magic.jscompareescape()andunescape()strings only, and none of their inputs contains*. WithmagicalBraces: truein POSIX mode the user braces are escaped, so a brace group from the caller is required.escape('\\{', { magicalBraces: true }) + '.{js,ts}'gives\\\{.{js,ts}, which does not match\{.json 11.0.5.{1..5000}(100 or more values,src/index.ts:263) is matched without brace-expansion in 11.0.5, so that suffix alone does not trigger behavior 3.Behavior 4:
windowsPathsNoEscape+magicalBraces.src/escape.ts:26-27: in this mode every magic character, including{and}, is wrapped in a one-character class:x{a,b}becomesx[{]a,b[}]. The README and the JSDoc atsrc/escape.ts:6-10justify this by saying a character class "can only be satisfied by that exact character".src/index.ts:599-601: in this mode backslashes are converted to/before parsing, so brace-expansion's\{escape is not available toescape().src/index.ts:251-256: the brace check regex and brace-expansion both see{]a,b[}as a brace set. brace-expansion splits it at the comma intox[]a]andx[b[].hasMagic()returnstrueand the literal does not match itself.Related note (not a numbered behavior): default options leave braces live.
With default options, and with
windowsPathsNoEscapealone,escape()does not escape{or}. On 11.0.5,escape('x{a,b}')returnsx{a,b}, which matchesxaand does not matchx{a,b}. The same holds with{ windowsPathsNoEscape: true }. The JSDoc atsrc/escape.ts:12-13says braces are escaped only withmagicalBraces. The README sentence has no such qualifier. Commit 0d27f1c ("SupportmagicalBracesoption in escape/unescape") states that it resolves #234. It made brace escaping opt-in and kept the default. The text of issue #234 itself was not read from this environment. This report treats the gap as a documentation issue, and the fix below does not change it. Either the README should state themagicalBracesrequirement, or the default should escape braces. The bisection shows the gap in every release from 7.4.0 to 11.0.5.Suggested fix
Two parts. Behaviors 1 and 2 are fixed in
src/escape.ts. Behaviors 3 and 4 cannot be fixed inescape.tsalone: every encoding of a literal backslash (\\,[\\]) and every class encoding of a brace ([{]) is rewritten by brace-expansion. The fix for those belongs inbraceExpand()insrc/index.ts, which is the single path to brace-expansion (#expandBraces()and all its fallbacks call it).src/escape.ts:src/unescape.ts, at the top ofunescape()(option (a) only):src/index.ts,braceExpand(), replacing the finalreturn expand(...):Why this is safe:
\\pairs left to right before it looks at\{,\},\,and\.(index.js:54-61). The doubling regex also works left to right. Each run of backslashes keeps its parity, so a trailing odd backslash still escapes the next character exactly as before. The only change is that\\now comes back as\\.[\{]and[\}]rewrite runs only inwindowsPathsNoEscapemode. On theMinimatchpath,src/index.ts:599-601has already turned every backslash into/, so the inserted backslash is the only one in the string. brace-expansion turns\{back into{(index.js:62-69), so the result contains[{]again.expand()when the input contained all of them. User text could force that fallback. Measured with that earlierbraceExpand()change applied to 11.0.5: checks 3, 3b, 4 and 4b pass, and P3 and P4 still fail (3 failed assertions; the PoC prints8 assertion(s) failedbecause that build does not include theescape.tschange, so checks 1, 1w, 2 and 2w also fail). This version picks no sentinel, so no input can exhaust one, and every pattern goes through the protected path. A fix that does need sentinels must return[pattern](no expansion) when none is free.^5.0.12. PoC checks 3 and 3b should become tests so a change in brace-expansion is caught.Windows mode and a leading
!: there is no clean encoding.[!opens a negated class, and backslash is a path separator in this mode. Measured on 11.0.5 in Windows mode with a trailinga:[!]a,[\!]a,[[=!=]]a,[[.!.]]aand./!ado not match!a, and[!-!]amatchesbaand not!a. Only@(!)amatches!aand nothing else among!a,ba,a,!,b, and it needs extglob. The two options, with measured trade-offs (port oftest/escape-has-magic.js, 811 upstream assertions):escape('!a', win)@(!)plus theunescape()change (shown above)@(!)ahasMagic()returnstruefor the 7 win32 entries that start with!('!a*'twice,'!!a*','!\\!a*','!(.a|js)@(.*)','!()y'twice). Those expectations must change. Withnoext: truethe pattern matches neither!anorb(fails closed).@(!)without theunescape()change@(!)ahasMagic()failures plus 7 failed win32unescape()round trips.!unescaped in Windows mode!apasswdmatches)nonegate: true; with it,!amatches!aand notb. Document this in the README.[#]for a leading#passes the upstream assertions in all three variants. Option (a) is the version verified below.Behavior change for patterns that do not come from
escape(): an escaped backslash next to a brace group now stays a literal backslash. On 11.0.5,{src,lib}/a\\b.js(intended: the literal filea\b.js) expands tosrc/a\b.jsandlib/a\b.js, matchessrc/ab.jsand does not matchsrc/a\b.js. With the fix it matchessrc/a\b.jsand notsrc/ab.js. Likewisea\\{b,c}matchedaband now matchesa\b. This is a correctness bug fix outside the security scope, but it is visible to users and belongs in the changelog. The publicminimatch.braceExpand()output changes for the same patterns. No pattern intest/patterns.jschanges (see the differential below).Local verification. The three changes were applied to a fresh copy of the installed 11.0.5
dist/commonjsanddist/esmfiles, with unpatched 11.0.5 as the control. Variants a0 and b were tested the same way. The TypeScript above was not compiled. The upstreamtapsuite was not run.PoC (
poc.jsabove): unpatched 11.0.5 prints14 assertion(s) failed. Patched:all assertions passed. That covers all 11 checks: 1, 1w, 2, 2w, 3, 3b (user-supplied braces), 3c, 4, 4b, P3 and P4 (the private-use-character fallback bypass).Port of
test/escape-has-magic.js(thetapsnapshot is replaced by a comparison of[set, hasMagic()]with unpatched 11.0.5):negate/commentassertionsAll 7 failures for option (a) are the win32
hasMagic() === falseassertions listed in the table above.Differential over
test/patterns.js(unpatched 11.0.5 against option (a)): 196 string patterns, matched against the 135 distinct file names in the expected-result lists of that file.braceExpand()output: 196 comparisons, 0 differences. Match results: 26,460 comparisons, 0 differences. The script also escapes every pattern in four modes (POSIX, POSIX +magicalBraces, Windows, Windows +magicalBraces) and checks that the escaped pattern matches its own literal. In Windows mode the literal is compared with backslashes converted to/, because backslash is a path separator in that mode. Unpatched: 15, 6, 15 and 15 misses. Patched: 12, 3, 12 and 3. The patch fixes 21 misses and introduces none. The 30 that remain are the related default-brace note (9 brace entries, 8 distinct patterns because*(a|{b|c,c})appears twice intest/patterns.js, in POSIX and Windows mode withoutmagicalBraces: 18 misses) and 3 patterns with..segments in all four modes (12 misses), which is path normalization.Random inputs: 20,000 inputs of 1 to 6 characters over
!#\*?{},[]()ab.+@-, withmagicalBraces: true, POSIX and Windows mode, with and without an appended.{js,ts}. Each escaped pattern is checked against its literal and against the probe pathsa,ab,passwd,a.js,b.js,xand the empty string. In Windows mode the literal is compared with backslashes converted to/, because backslash is a path separator in that mode. In the.{js,ts}mode,.jsis appended to the literal and to each probe path that does not already end in.js. A self-miss is a pattern that does not match its literal. An over-match is a pattern that matches at least one probe path..{js,ts}.{js,ts}The 16 remaining Windows cases are two distinct strings,
@@\..and![\.., each generated 8 times. Each case is both a self-miss and an over-match. Both strings end in a backslash followed by.., which becomes a..path segment. That is path normalization, not escaping.Tests to add:
escape('!x'),escape('#x'),escape('x\\*') + '.{a,b}', andescape('x{a,b}', { windowsPathsNoEscape: true, magicalBraces: true })must each match the literal and must not matchx,a, orpasswd.escape('x\\*{,}')with default options must not matchx\anything.escape('!a', { windowsPathsNoEscape: true })must match!aand notb. Thenoext: truebehavior must be decided and asserted..{js,ts}, must not match a wildcard path.test/escape-has-magic.jsshould assertnegate === falseandcomment === false. With option (a), its win32hasMagic()expectations for inputs that start with!change totrue.Affected versions by behavior
GHSA form field:
>= 7.4.0, <= 11.0.5.escape()first shipped in 7.4.0 (commit327cb60). 7.3.0 has noescapeexport. Per behavior:!) and behavior 2 (leading#):>= 7.4.0, <= 11.0.5, no gaps. The brace-expansion version has no effect.@isaacs/brace-expansion5.0.0 and 5.0.1. Those turnx\\\*.{js,ts}intox\..jsandx\..ts, so even the literal stops matching (fails closed). On a fresh install that gives>= 7.4.0 < 10.0.0 || 10.0.1 || >= 10.1.3 <= 11.0.5. 9.0.6 to 9.0.8, 10.1.3 and 10.2.0 to 10.2.4 declare^5.0.2and are not affected when a lockfile pins brace-expansion 5.0.2 or 5.0.3. 10.0.0 and 10.0.2 (^4.x) and 10.0.3 to 10.1.2 (@isaacs/brace-expansion ^5.0.x) are not affected.windowsPathsNoEscape+magicalBraces):>= 10.1.0, <= 11.0.5, no gaps.escape()gained themagicalBracesoption in 10.1.0 (commit0d27f1c). Before that it returnsx{a,b}unchanged, which is the related default-brace note, not behavior 4.Bisection: all 50 releases from 7.3.0 to 11.0.5 were installed, each in its own directory with
npm i --ignore-scripts minimatch@V, and tested in one process per install. Results on a fresh install (B3 and B3b gave the same result in every release):escape()The brace-expansion boundary was confirmed with npm
overrides: minimatch 10.2.0 with brace-expansion 5.0.3 is not affected and with 5.0.4 is affected; 9.0.6 with 5.0.2 is not affected; 7.4.0 with 2.0.1 is affected. Each of the 27 brace-expansion releases that minimatch 7.4.0 to 11.0.5 can resolve (2.0.0 to 2.1.7, 4.0.0, 4.0.1, 5.0.2 to 5.0.12, and@isaacs/brace-expansion5.0.0 and 5.0.1) was also fedx\\\*.{js,ts}directly, with the results listed above. No minimatch release declares brace-expansion 3.x, so 3.0.0 to 3.0.9 were not tested.Credits
Reported by: agntflw
Proof of concept
Setup:
npm i minimatch@11.0.5, save the script aspoc.jsin the same directory, then runnode poc.js. The script has no other dependencies.Output on macOS, Node.js v24.2.0, minimatch 11.0.5, brace-expansion 5.0.12:
Notes on the output:
!secret.txtmatches itself only because the negated pattern excludessecret.txt, not!secret.txt.passwdshows the negation.Impact
The impact depends on how the application uses the result. The precondition for every case is an application that passes user-controlled text through
escape()and uses the resulting pattern for an access, filter, or exclusion decision. Each case below follows that pattern.!, allowlist. A file-sharing feature builds an allow pattern per shared file:allow.push(escape(fileName)), then grants access whenminimatch(requestedPath, p)is true for anyp. A tenant uploads a file named!a.txtand shares it. The share grants access to every path excepta.txt, including other files in the same scope. If the list is a denylist instead, the same file name blocks every other path.#, denylist or ignore list. A backup or publish step excludes user-selected files:exclude.push(escape(name)). A file named#secret#(the Emacs autosave naming scheme) or#notes.mdis never excluded and is uploaded or published. No error is reported.escape(name) + '.{js,ts}'. On POSIX,\is a legal file name character. A user who can create a file namedx\*gets a pattern that matches any file in that directory whose name starts withx\and ends in.jsor.ts. With default options the application does not need to add a brace group: the namex\*{,}alone gives a pattern that matches any name that starts withx\. The over-match is limited to one path segment, to the user's chosen prefix, and to names that contain a literal backslash.windowsPathsNoEscape+magicalBraces. An application on Windows escapes names with both options so braces are literal. The namereport{draft,final}.docxbecomesreport[{]draft,final[}].docx, which expands toreport[]draft].docxandreport[final[].docx. That pattern matches any name made ofreport, one character from]draftorfinal[, and.docx(for examplereportd.docx,reporta.docx,report].docx,report[.docx). It does not matchreport{draft,final}.docx. For the input{secret,b}the pattern matches any one-character name from]secretorb[(for exampleb,[,],s), and does not match{secret,b}orsecret. A denylist entry silently fails to block the file. An allowlist entry admits unrelated names.This is not remote code execution and not a denial of service. It is an integrity and confidentiality issue in security decisions that rely on
escape().Workarounds until a fix ships (each measured on 11.0.5):
{ nonegate: true, nocomment: true }when matching escaped patterns. Withnonegate,escape('!secret.txt')matches!secret.txtand notpasswd. Withnocomment,escape('#notes.md')matches#notes.md. This covers both modes.{ magicalBraces: true }so user braces are escaped. Passingnobrace: truestops the over-match (x\anything.jsno longer matches), but the caller's brace group then becomes literal:x\*.jsno longer matches either, and onlyx\*.{js,ts}does. Expand the group in application code instead.nobrace: truewhen matching. With{ windowsPathsNoEscape: true, magicalBraces: true, nobrace: true },x[{]a,b[}]matchesx{a,b}and notxa. On POSIX,{ magicalBraces: true }withoutwindowsPathsNoEscapegivesx\{a,b\}, which matches only the literal. DroppingmagicalBracesdoes not help:escape('x{a,b}', { windowsPathsNoEscape: true })returnsx{a,b}, which matchesxaand not the literal.Severity
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
isaacs/minimatch (minimatch)
v11.0.8Compare Source
v11.0.7Compare Source
mergeRows)Fixes GHSA-cf2h-pxjq-68xw: GHSA-cf2h-pxjq-68xw
v11.0.6Compare Source
v11.0.5Compare Source
v11.0.4Compare Source
v11.0.3Compare Source
v11.0.2Compare Source
v11.0.1Compare Source
v11.0.0Compare Source
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ 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 was generated by Mend Renovate. View the repository job log.