diff --git a/docs/patches/picomatch@2.3.2.patch b/docs/patches/picomatch@2.3.2.patch index 9405b29f..15ac5a6b 100644 --- a/docs/patches/picomatch@2.3.2.patch +++ b/docs/patches/picomatch@2.3.2.patch @@ -1,8 +1,8 @@ diff --git a/lib/parse.js b/lib/parse.js -index caa2b86aa5a567df33cef4bda3c7a97794f439f8..b5e0a33480897aef82fe9c6dfb6e8ee2b56afd63 100644 +index caa2b86aa5a567df33cef4bda3c7a97794f439f8..a34abd76c4ef079277c93e33917ceeda634b3ec6 100644 --- a/lib/parse.js +++ b/lib/parse.js -@@ -280,7 +280,36 @@ const repeatedExtglobRecursion = pattern => { +@@ -280,7 +280,51 @@ const repeatedExtglobRecursion = pattern => { return depth; }; @@ -36,11 +36,26 @@ index caa2b86aa5a567df33cef4bda3c7a97794f439f8..b5e0a33480897aef82fe9c6dfb6e8ee2 + }); +}; + ++// A repeated body with a slash, such as `+(src/*/)`, backtracks only when one ++// path segment holds two `*`s. The last segment of a repeat and the first ++// segment of the next share one path segment, so they count together. A ++// globstar crosses `/`, so `+(**/a)` never qualifies, and neither does `+(*/*)`. ++const hasUnambiguousSegments = bodyTokens => { ++ const stars = [0]; ++ for (const tok of bodyTokens) { ++ if (tok.type === 'globstar') return false; ++ if (tok.type === 'slash') stars.push(0); ++ if (tok.type === 'star' && tok.value !== '') stars[stars.length - 1]++; ++ } ++ if (stars.length < 2) return false; ++ return stars[0] + stars[stars.length - 1] <= 1 && stars.slice(1, -1).every(n => n <= 1); ++}; ++ +const analyzeRepeatedExtglob = (body, options, bodyTokens = []) => { if (options.maxExtglobRecursion === false) { return { risky: false }; } -@@ -292,6 +321,24 @@ const analyzeRepeatedExtglob = (body, options) => { +@@ -292,6 +336,23 @@ const analyzeRepeatedExtglob = (body, options) => { const branches = splitTopLevel(body).map(branch => branch.trim()); @@ -55,9 +70,8 @@ index caa2b86aa5a567df33cef4bda3c7a97794f439f8..b5e0a33480897aef82fe9c6dfb6e8ee2 + } + + // A literal slash fixes where each repeat starts, since `*` cannot cross -+ // it outside bash mode, so the repeat cannot backtrack. -+ const hasSlash = bodyTokens.some(tok => tok.type === 'slash'); -+ if (options.bash === true || !hasSlash) { ++ // it outside bash mode, unless the slash-separated parts split ambiguously. ++ if (options.bash === true || !hasUnambiguousSegments(bodyTokens)) { + return { risky: true }; + } + } @@ -65,7 +79,7 @@ index caa2b86aa5a567df33cef4bda3c7a97794f439f8..b5e0a33480897aef82fe9c6dfb6e8ee2 if (branches.length > 1) { if ( branches.some(branch => branch === '') || -@@ -510,7 +557,7 @@ const parse = (input, options) => { +@@ -510,7 +571,7 @@ const parse = (input, options) => { const extglobClose = token => { const literal = input.slice(token.startIndex, state.index + 1); const body = input.slice(token.startIndex + 2, state.index); @@ -74,7 +88,7 @@ index caa2b86aa5a567df33cef4bda3c7a97794f439f8..b5e0a33480897aef82fe9c6dfb6e8ee2 if ((token.type === 'plus' || token.type === 'star') && analysis.risky) { const safeOutput = analysis.safeOutput -@@ -536,6 +583,10 @@ const parse = (input, options) => { +@@ -536,6 +597,10 @@ const parse = (input, options) => { return; } diff --git a/docs/patches/picomatch@4.0.7.patch b/docs/patches/picomatch@4.0.7.patch index c5fab983..44ccf718 100644 --- a/docs/patches/picomatch@4.0.7.patch +++ b/docs/patches/picomatch@4.0.7.patch @@ -1,8 +1,8 @@ diff --git a/lib/parse.js b/lib/parse.js -index 29207512c60183b4bb9bf5112be3b9b5f4a9a9fd..296afb16b857e181315a800630978fea9f139929 100644 +index 29207512c60183b4bb9bf5112be3b9b5f4a9a9fd..57a2333dfccc5005786b4805a749300a2de98f6f 100644 --- a/lib/parse.js +++ b/lib/parse.js -@@ -284,7 +284,36 @@ const repeatedExtglobRecursion = pattern => { +@@ -284,7 +284,51 @@ const repeatedExtglobRecursion = pattern => { return depth; }; @@ -36,11 +36,26 @@ index 29207512c60183b4bb9bf5112be3b9b5f4a9a9fd..296afb16b857e181315a800630978fea + }); +}; + ++// A repeated body with a slash, such as `+(src/*/)`, backtracks only when one ++// path segment holds two `*`s. The last segment of a repeat and the first ++// segment of the next share one path segment, so they count together. A ++// globstar crosses `/`, so `+(**/a)` never qualifies, and neither does `+(*/*)`. ++const hasUnambiguousSegments = bodyTokens => { ++ const stars = [0]; ++ for (const tok of bodyTokens) { ++ if (tok.type === 'globstar') return false; ++ if (tok.type === 'slash') stars.push(0); ++ if (tok.type === 'star' && tok.value !== '') stars[stars.length - 1]++; ++ } ++ if (stars.length < 2) return false; ++ return stars[0] + stars[stars.length - 1] <= 1 && stars.slice(1, -1).every(n => n <= 1); ++}; ++ +const analyzeRepeatedExtglob = (body, options, bodyTokens = []) => { if (options.maxExtglobRecursion === false) { return { risky: false }; } -@@ -296,6 +325,24 @@ const analyzeRepeatedExtglob = (body, options) => { +@@ -296,6 +340,23 @@ const analyzeRepeatedExtglob = (body, options) => { const branches = splitTopLevel(body).map(branch => branch.trim()); @@ -55,9 +70,8 @@ index 29207512c60183b4bb9bf5112be3b9b5f4a9a9fd..296afb16b857e181315a800630978fea + } + + // A literal slash fixes where each repeat starts, since `*` cannot cross -+ // it outside bash mode, so the repeat cannot backtrack. -+ const hasSlash = bodyTokens.some(tok => tok.type === 'slash'); -+ if (options.bash === true || !hasSlash) { ++ // it outside bash mode, unless the slash-separated parts split ambiguously. ++ if (options.bash === true || !hasUnambiguousSegments(bodyTokens)) { + return { risky: true }; + } + } @@ -65,7 +79,7 @@ index 29207512c60183b4bb9bf5112be3b9b5f4a9a9fd..296afb16b857e181315a800630978fea if (branches.length > 1) { if ( branches.some(branch => branch === '') || -@@ -539,7 +586,7 @@ const parse = (input, options) => { +@@ -539,7 +600,7 @@ const parse = (input, options) => { const extglobClose = token => { const literal = input.slice(token.startIndex, state.index + 1); const body = input.slice(token.startIndex + 2, state.index); @@ -74,7 +88,7 @@ index 29207512c60183b4bb9bf5112be3b9b5f4a9a9fd..296afb16b857e181315a800630978fea if ((token.type === 'plus' || token.type === 'star') && analysis.risky) { const safeOutput = analysis.safeOutput -@@ -565,6 +612,10 @@ const parse = (input, options) => { +@@ -565,6 +626,10 @@ const parse = (input, options) => { return; } diff --git a/docs/pnpm-lock.yaml b/docs/pnpm-lock.yaml index 543c8f5c..80f21af2 100644 --- a/docs/pnpm-lock.yaml +++ b/docs/pnpm-lock.yaml @@ -23,10 +23,10 @@ patchedDependencies: hash: 97e6a6643e115456a2b6a536977aa7f471d5a5397a27b9d4732415c35054eded path: patches/http-cache-semantics@4.3.0.patch picomatch@2.3.2: - hash: c183c92455b30f6253012a28ee01efc6344060768e13cc3519e83b86ac73a784 + hash: 5d18cf16766c61665e242ea45904b9ca30eef5db10cc2079b143ae1433b7529b path: patches/picomatch@2.3.2.patch picomatch@4.0.7: - hash: e10f889f737d1a1a04446d3866b3fe472b92bbb9c546530286bf226af1a3b8e4 + hash: 026c5be8bd82707b8f9d46a371b0dea4143e4a5a671a41e0ea44c0672ae14eec path: patches/picomatch@4.0.7.patch importers: @@ -2342,7 +2342,7 @@ snapshots: '@types/hast': 3.0.4 '@types/mdast': 4.0.4 js-yaml: 4.3.2 - picomatch: 4.0.7(patch_hash=e10f889f737d1a1a04446d3866b3fe472b92bbb9c546530286bf226af1a3b8e4) + picomatch: 4.0.7(patch_hash=026c5be8bd82707b8f9d46a371b0dea4143e4a5a671a41e0ea44c0672ae14eec) retext-smartypants: 6.2.0 shiki: 4.4.3 smol-toml: 1.9.1 @@ -2352,7 +2352,7 @@ snapshots: dependencies: '@types/hast': 3.0.5 '@types/mdast': 4.0.4 - picomatch: 4.0.7(patch_hash=e10f889f737d1a1a04446d3866b3fe472b92bbb9c546530286bf226af1a3b8e4) + picomatch: 4.0.7(patch_hash=026c5be8bd82707b8f9d46a371b0dea4143e4a5a671a41e0ea44c0672ae14eec) retext-smartypants: 6.2.0 shiki: 4.5.0 smol-toml: 1.9.1 @@ -3185,7 +3185,7 @@ snapshots: anymatch@3.1.3: dependencies: normalize-path: 3.0.0 - picomatch: 2.3.2(patch_hash=c183c92455b30f6253012a28ee01efc6344060768e13cc3519e83b86ac73a784) + picomatch: 2.3.2(patch_hash=5d18cf16766c61665e242ea45904b9ca30eef5db10cc2079b143ae1433b7529b) arg@5.0.2: {} @@ -3239,7 +3239,7 @@ snapshots: p-queue: 10.0.0 package-manager-detector: 1.9.0 piccolore: 0.1.3 - picomatch: 4.0.7(patch_hash=e10f889f737d1a1a04446d3866b3fe472b92bbb9c546530286bf226af1a3b8e4) + picomatch: 4.0.7(patch_hash=026c5be8bd82707b8f9d46a371b0dea4143e4a5a671a41e0ea44c0672ae14eec) rolldown: 1.3.2 shiki: 4.5.0 smol-toml: 1.9.1 @@ -3518,9 +3518,9 @@ snapshots: dependencies: fast-string-width: 3.0.2 - fdir@6.5.0(picomatch@4.0.7(patch_hash=e10f889f737d1a1a04446d3866b3fe472b92bbb9c546530286bf226af1a3b8e4)): + fdir@6.5.0(picomatch@4.0.7(patch_hash=026c5be8bd82707b8f9d46a371b0dea4143e4a5a671a41e0ea44c0672ae14eec)): optionalDependencies: - picomatch: 4.0.7(patch_hash=e10f889f737d1a1a04446d3866b3fe472b92bbb9c546530286bf226af1a3b8e4) + picomatch: 4.0.7(patch_hash=026c5be8bd82707b8f9d46a371b0dea4143e4a5a671a41e0ea44c0672ae14eec) flattie@1.1.1: {} @@ -4396,9 +4396,9 @@ snapshots: picocolors@1.1.1: {} - picomatch@2.3.2(patch_hash=c183c92455b30f6253012a28ee01efc6344060768e13cc3519e83b86ac73a784): {} + picomatch@2.3.2(patch_hash=5d18cf16766c61665e242ea45904b9ca30eef5db10cc2079b143ae1433b7529b): {} - picomatch@4.0.7(patch_hash=e10f889f737d1a1a04446d3866b3fe472b92bbb9c546530286bf226af1a3b8e4): {} + picomatch@4.0.7(patch_hash=026c5be8bd82707b8f9d46a371b0dea4143e4a5a671a41e0ea44c0672ae14eec): {} postcss-nested@8.0.1(postcss@8.5.33): dependencies: @@ -4783,8 +4783,8 @@ snapshots: tinyglobby@0.2.17: dependencies: - fdir: 6.5.0(picomatch@4.0.7(patch_hash=e10f889f737d1a1a04446d3866b3fe472b92bbb9c546530286bf226af1a3b8e4)) - picomatch: 4.0.7(patch_hash=e10f889f737d1a1a04446d3866b3fe472b92bbb9c546530286bf226af1a3b8e4) + fdir: 6.5.0(picomatch@4.0.7(patch_hash=026c5be8bd82707b8f9d46a371b0dea4143e4a5a671a41e0ea44c0672ae14eec)) + picomatch: 4.0.7(patch_hash=026c5be8bd82707b8f9d46a371b0dea4143e4a5a671a41e0ea44c0672ae14eec) tinyps@0.5.1: {} @@ -4905,7 +4905,7 @@ snapshots: vite@8.3.8(@types/node@25.0.3)(esbuild@0.28.2)(yaml@2.9.1): dependencies: lightningcss: 1.33.0 - picomatch: 4.0.7(patch_hash=e10f889f737d1a1a04446d3866b3fe472b92bbb9c546530286bf226af1a3b8e4) + picomatch: 4.0.7(patch_hash=026c5be8bd82707b8f9d46a371b0dea4143e4a5a671a41e0ea44c0672ae14eec) postcss: 8.5.33 rolldown: 1.2.19 tinyglobby: 0.2.17 diff --git a/docs/tests/fixtures/picomatch-redos.cjs b/docs/tests/fixtures/picomatch-redos.cjs index 5bfa39e2..d85e30d8 100644 --- a/docs/tests/fixtures/picomatch-redos.cjs +++ b/docs/tests/fixtures/picomatch-redos.cjs @@ -3,8 +3,22 @@ // quantifier. Runs in a child process because a backtracking regex blocks // its own event loop. Usage: node picomatch-redos.cjs const picomatch = require(process.argv[2]); -const globs = ['+(*)', '+(*a)', '*(*a)', '+(a*)b', '+(*[a])', '+(@(*a))']; -const inputs = ['a'.repeat(50000) + '!', 'a'.repeat(50000) + '/']; +const globs = [ + '+(*)', + '+(*a)', + '*(*a)', + '+(a*)b', + '+(*[a])', + '+(@(*a))', + '+(*/*)', + '+(**/a)', +]; +const inputs = [ + 'a'.repeat(50000) + '!', + 'a'.repeat(50000) + '/', + 'aa/'.repeat(3000) + '.x', + 'a/'.repeat(5000) + '!', +]; for (const glob of globs) { for (const input of inputs) { picomatch(glob)(input); diff --git a/patches/README.md b/patches/README.md index e8cf645c..0507c80b 100644 --- a/patches/README.md +++ b/patches/README.md @@ -28,7 +28,10 @@ repetition, so `+(P)` compiles as `(P)` and `*(P)` as `(P)?`, with the same matches. Unlike upstream, the patch checks each compiled bracket class, because a range such as `[+-0]` includes `/`. Other single-branch wildcard bodies are literalized, like the existing risky-extglob guard. A branch with a literal `/` -keeps its repetition, because the slash fixes where each repeat starts. In root they +keeps its repetition only when no path segment can hold two `*`s, counting the +last segment of one repeat with the first segment of the next. So `+(src/*/)` +keeps working, while `+(*/*)` and `+(**/a)` (a globstar crosses `/`) are +literalized. In root they cover the CLI globbing (`micromatch`), `typescript-eslint`, and build-time watcher paths. Docs keeps identical copies under `../docs/patches/` for Astro. Run `pnpm test src/__tests__/dependency-security.test.ts` and `pnpm --dir docs test`. diff --git a/patches/picomatch@2.3.2.patch b/patches/picomatch@2.3.2.patch index 9405b29f..15ac5a6b 100644 --- a/patches/picomatch@2.3.2.patch +++ b/patches/picomatch@2.3.2.patch @@ -1,8 +1,8 @@ diff --git a/lib/parse.js b/lib/parse.js -index caa2b86aa5a567df33cef4bda3c7a97794f439f8..b5e0a33480897aef82fe9c6dfb6e8ee2b56afd63 100644 +index caa2b86aa5a567df33cef4bda3c7a97794f439f8..a34abd76c4ef079277c93e33917ceeda634b3ec6 100644 --- a/lib/parse.js +++ b/lib/parse.js -@@ -280,7 +280,36 @@ const repeatedExtglobRecursion = pattern => { +@@ -280,7 +280,51 @@ const repeatedExtglobRecursion = pattern => { return depth; }; @@ -36,11 +36,26 @@ index caa2b86aa5a567df33cef4bda3c7a97794f439f8..b5e0a33480897aef82fe9c6dfb6e8ee2 + }); +}; + ++// A repeated body with a slash, such as `+(src/*/)`, backtracks only when one ++// path segment holds two `*`s. The last segment of a repeat and the first ++// segment of the next share one path segment, so they count together. A ++// globstar crosses `/`, so `+(**/a)` never qualifies, and neither does `+(*/*)`. ++const hasUnambiguousSegments = bodyTokens => { ++ const stars = [0]; ++ for (const tok of bodyTokens) { ++ if (tok.type === 'globstar') return false; ++ if (tok.type === 'slash') stars.push(0); ++ if (tok.type === 'star' && tok.value !== '') stars[stars.length - 1]++; ++ } ++ if (stars.length < 2) return false; ++ return stars[0] + stars[stars.length - 1] <= 1 && stars.slice(1, -1).every(n => n <= 1); ++}; ++ +const analyzeRepeatedExtglob = (body, options, bodyTokens = []) => { if (options.maxExtglobRecursion === false) { return { risky: false }; } -@@ -292,6 +321,24 @@ const analyzeRepeatedExtglob = (body, options) => { +@@ -292,6 +336,23 @@ const analyzeRepeatedExtglob = (body, options) => { const branches = splitTopLevel(body).map(branch => branch.trim()); @@ -55,9 +70,8 @@ index caa2b86aa5a567df33cef4bda3c7a97794f439f8..b5e0a33480897aef82fe9c6dfb6e8ee2 + } + + // A literal slash fixes where each repeat starts, since `*` cannot cross -+ // it outside bash mode, so the repeat cannot backtrack. -+ const hasSlash = bodyTokens.some(tok => tok.type === 'slash'); -+ if (options.bash === true || !hasSlash) { ++ // it outside bash mode, unless the slash-separated parts split ambiguously. ++ if (options.bash === true || !hasUnambiguousSegments(bodyTokens)) { + return { risky: true }; + } + } @@ -65,7 +79,7 @@ index caa2b86aa5a567df33cef4bda3c7a97794f439f8..b5e0a33480897aef82fe9c6dfb6e8ee2 if (branches.length > 1) { if ( branches.some(branch => branch === '') || -@@ -510,7 +557,7 @@ const parse = (input, options) => { +@@ -510,7 +571,7 @@ const parse = (input, options) => { const extglobClose = token => { const literal = input.slice(token.startIndex, state.index + 1); const body = input.slice(token.startIndex + 2, state.index); @@ -74,7 +88,7 @@ index caa2b86aa5a567df33cef4bda3c7a97794f439f8..b5e0a33480897aef82fe9c6dfb6e8ee2 if ((token.type === 'plus' || token.type === 'star') && analysis.risky) { const safeOutput = analysis.safeOutput -@@ -536,6 +583,10 @@ const parse = (input, options) => { +@@ -536,6 +597,10 @@ const parse = (input, options) => { return; } diff --git a/patches/picomatch@4.0.7.patch b/patches/picomatch@4.0.7.patch index c5fab983..44ccf718 100644 --- a/patches/picomatch@4.0.7.patch +++ b/patches/picomatch@4.0.7.patch @@ -1,8 +1,8 @@ diff --git a/lib/parse.js b/lib/parse.js -index 29207512c60183b4bb9bf5112be3b9b5f4a9a9fd..296afb16b857e181315a800630978fea9f139929 100644 +index 29207512c60183b4bb9bf5112be3b9b5f4a9a9fd..57a2333dfccc5005786b4805a749300a2de98f6f 100644 --- a/lib/parse.js +++ b/lib/parse.js -@@ -284,7 +284,36 @@ const repeatedExtglobRecursion = pattern => { +@@ -284,7 +284,51 @@ const repeatedExtglobRecursion = pattern => { return depth; }; @@ -36,11 +36,26 @@ index 29207512c60183b4bb9bf5112be3b9b5f4a9a9fd..296afb16b857e181315a800630978fea + }); +}; + ++// A repeated body with a slash, such as `+(src/*/)`, backtracks only when one ++// path segment holds two `*`s. The last segment of a repeat and the first ++// segment of the next share one path segment, so they count together. A ++// globstar crosses `/`, so `+(**/a)` never qualifies, and neither does `+(*/*)`. ++const hasUnambiguousSegments = bodyTokens => { ++ const stars = [0]; ++ for (const tok of bodyTokens) { ++ if (tok.type === 'globstar') return false; ++ if (tok.type === 'slash') stars.push(0); ++ if (tok.type === 'star' && tok.value !== '') stars[stars.length - 1]++; ++ } ++ if (stars.length < 2) return false; ++ return stars[0] + stars[stars.length - 1] <= 1 && stars.slice(1, -1).every(n => n <= 1); ++}; ++ +const analyzeRepeatedExtglob = (body, options, bodyTokens = []) => { if (options.maxExtglobRecursion === false) { return { risky: false }; } -@@ -296,6 +325,24 @@ const analyzeRepeatedExtglob = (body, options) => { +@@ -296,6 +340,23 @@ const analyzeRepeatedExtglob = (body, options) => { const branches = splitTopLevel(body).map(branch => branch.trim()); @@ -55,9 +70,8 @@ index 29207512c60183b4bb9bf5112be3b9b5f4a9a9fd..296afb16b857e181315a800630978fea + } + + // A literal slash fixes where each repeat starts, since `*` cannot cross -+ // it outside bash mode, so the repeat cannot backtrack. -+ const hasSlash = bodyTokens.some(tok => tok.type === 'slash'); -+ if (options.bash === true || !hasSlash) { ++ // it outside bash mode, unless the slash-separated parts split ambiguously. ++ if (options.bash === true || !hasUnambiguousSegments(bodyTokens)) { + return { risky: true }; + } + } @@ -65,7 +79,7 @@ index 29207512c60183b4bb9bf5112be3b9b5f4a9a9fd..296afb16b857e181315a800630978fea if (branches.length > 1) { if ( branches.some(branch => branch === '') || -@@ -539,7 +586,7 @@ const parse = (input, options) => { +@@ -539,7 +600,7 @@ const parse = (input, options) => { const extglobClose = token => { const literal = input.slice(token.startIndex, state.index + 1); const body = input.slice(token.startIndex + 2, state.index); @@ -74,7 +88,7 @@ index 29207512c60183b4bb9bf5112be3b9b5f4a9a9fd..296afb16b857e181315a800630978fea if ((token.type === 'plus' || token.type === 'star') && analysis.risky) { const safeOutput = analysis.safeOutput -@@ -565,6 +612,10 @@ const parse = (input, options) => { +@@ -565,6 +626,10 @@ const parse = (input, options) => { return; } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b02b0dee..ab4b8280 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -46,10 +46,10 @@ patchedDependencies: hash: 1da2e5cc2a0608f1dbb4033e149ade9c1fe19309a53c48032a0e4a06039d9b03 path: patches/braces@3.0.3.patch picomatch@2.3.2: - hash: c183c92455b30f6253012a28ee01efc6344060768e13cc3519e83b86ac73a784 + hash: 5d18cf16766c61665e242ea45904b9ca30eef5db10cc2079b143ae1433b7529b path: patches/picomatch@2.3.2.patch picomatch@4.0.7: - hash: e10f889f737d1a1a04446d3866b3fe472b92bbb9c546530286bf226af1a3b8e4 + hash: 026c5be8bd82707b8f9d46a371b0dea4143e4a5a671a41e0ea44c0672ae14eec path: patches/picomatch@4.0.7.patch importers: @@ -4889,7 +4889,7 @@ snapshots: anymatch@3.1.3: dependencies: normalize-path: 3.0.0 - picomatch: 2.3.2(patch_hash=c183c92455b30f6253012a28ee01efc6344060768e13cc3519e83b86ac73a784) + picomatch: 2.3.2(patch_hash=5d18cf16766c61665e242ea45904b9ca30eef5db10cc2079b143ae1433b7529b) anynum@1.0.1: {} @@ -5348,9 +5348,9 @@ snapshots: dependencies: reusify: 1.1.0 - fdir@6.5.0(picomatch@4.0.7(patch_hash=e10f889f737d1a1a04446d3866b3fe472b92bbb9c546530286bf226af1a3b8e4)): + fdir@6.5.0(picomatch@4.0.7(patch_hash=026c5be8bd82707b8f9d46a371b0dea4143e4a5a671a41e0ea44c0672ae14eec)): optionalDependencies: - picomatch: 4.0.7(patch_hash=e10f889f737d1a1a04446d3866b3fe472b92bbb9c546530286bf226af1a3b8e4) + picomatch: 4.0.7(patch_hash=026c5be8bd82707b8f9d46a371b0dea4143e4a5a671a41e0ea44c0672ae14eec) file-entry-cache@8.0.0: dependencies: @@ -5727,7 +5727,7 @@ snapshots: micromatch@4.0.8: dependencies: braces: 3.0.3(patch_hash=1da2e5cc2a0608f1dbb4033e149ade9c1fe19309a53c48032a0e4a06039d9b03) - picomatch: 2.3.2(patch_hash=c183c92455b30f6253012a28ee01efc6344060768e13cc3519e83b86ac73a784) + picomatch: 2.3.2(patch_hash=5d18cf16766c61665e242ea45904b9ca30eef5db10cc2079b143ae1433b7529b) mime-db@1.52.0: {} @@ -5885,9 +5885,9 @@ snapshots: picocolors@1.1.1: {} - picomatch@2.3.2(patch_hash=c183c92455b30f6253012a28ee01efc6344060768e13cc3519e83b86ac73a784): {} + picomatch@2.3.2(patch_hash=5d18cf16766c61665e242ea45904b9ca30eef5db10cc2079b143ae1433b7529b): {} - picomatch@4.0.7(patch_hash=e10f889f737d1a1a04446d3866b3fe472b92bbb9c546530286bf226af1a3b8e4): {} + picomatch@4.0.7(patch_hash=026c5be8bd82707b8f9d46a371b0dea4143e4a5a671a41e0ea44c0672ae14eec): {} portable-executable-signature@2.0.6: {} @@ -5951,7 +5951,7 @@ snapshots: readdirp@3.6.0: dependencies: - picomatch: 2.3.2(patch_hash=c183c92455b30f6253012a28ee01efc6344060768e13cc3519e83b86ac73a784) + picomatch: 2.3.2(patch_hash=5d18cf16766c61665e242ea45904b9ca30eef5db10cc2079b143ae1433b7529b) require-from-string@2.0.2: {} @@ -6209,8 +6209,8 @@ snapshots: tinyglobby@0.2.17: dependencies: - fdir: 6.5.0(picomatch@4.0.7(patch_hash=e10f889f737d1a1a04446d3866b3fe472b92bbb9c546530286bf226af1a3b8e4)) - picomatch: 4.0.7(patch_hash=e10f889f737d1a1a04446d3866b3fe472b92bbb9c546530286bf226af1a3b8e4) + fdir: 6.5.0(picomatch@4.0.7(patch_hash=026c5be8bd82707b8f9d46a371b0dea4143e4a5a671a41e0ea44c0672ae14eec)) + picomatch: 4.0.7(patch_hash=026c5be8bd82707b8f9d46a371b0dea4143e4a5a671a41e0ea44c0672ae14eec) tinyrainbow@3.1.1: {} @@ -6299,8 +6299,8 @@ snapshots: vite@7.3.7(@types/node@24.13.2)(tsx@4.21.0): dependencies: esbuild: 0.28.1 - fdir: 6.5.0(picomatch@4.0.7(patch_hash=e10f889f737d1a1a04446d3866b3fe472b92bbb9c546530286bf226af1a3b8e4)) - picomatch: 4.0.7(patch_hash=e10f889f737d1a1a04446d3866b3fe472b92bbb9c546530286bf226af1a3b8e4) + fdir: 6.5.0(picomatch@4.0.7(patch_hash=026c5be8bd82707b8f9d46a371b0dea4143e4a5a671a41e0ea44c0672ae14eec)) + picomatch: 4.0.7(patch_hash=026c5be8bd82707b8f9d46a371b0dea4143e4a5a671a41e0ea44c0672ae14eec) postcss: 8.5.24 rollup: 4.61.1 tinyglobby: 0.2.17 @@ -6323,7 +6323,7 @@ snapshots: magic-string: 0.30.21 obug: 2.2.1 pathe: 2.0.3 - picomatch: 4.0.7(patch_hash=e10f889f737d1a1a04446d3866b3fe472b92bbb9c546530286bf226af1a3b8e4) + picomatch: 4.0.7(patch_hash=026c5be8bd82707b8f9d46a371b0dea4143e4a5a671a41e0ea44c0672ae14eec) std-env: 4.2.0 tinybench: 2.9.0 tinyexec: 1.3.1 diff --git a/src/__tests__/fixtures/picomatch-redos.cjs b/src/__tests__/fixtures/picomatch-redos.cjs index 5bfa39e2..d85e30d8 100644 --- a/src/__tests__/fixtures/picomatch-redos.cjs +++ b/src/__tests__/fixtures/picomatch-redos.cjs @@ -3,8 +3,22 @@ // quantifier. Runs in a child process because a backtracking regex blocks // its own event loop. Usage: node picomatch-redos.cjs const picomatch = require(process.argv[2]); -const globs = ['+(*)', '+(*a)', '*(*a)', '+(a*)b', '+(*[a])', '+(@(*a))']; -const inputs = ['a'.repeat(50000) + '!', 'a'.repeat(50000) + '/']; +const globs = [ + '+(*)', + '+(*a)', + '*(*a)', + '+(a*)b', + '+(*[a])', + '+(@(*a))', + '+(*/*)', + '+(**/a)', +]; +const inputs = [ + 'a'.repeat(50000) + '!', + 'a'.repeat(50000) + '/', + 'aa/'.repeat(3000) + '.x', + 'a/'.repeat(5000) + '!', +]; for (const glob of globs) { for (const input of inputs) { picomatch(glob)(input);