Repository navigation
[3728 by Claude Opus 5.5] Vendored picomatch: a group followed by + still takes seconds on a 27-character string - #3735
Conversation
…se body can match the same text in more than one way. Every pattern from the issue returns in under 1 ms on a 5,000-character non-matching string, in both builds. I ran `test:unit` and the picomatch tests, not the full `npm run test:full` suite.
How it works. The existing extglob guard turns a risky `+(...)` into literal text, so I did the same here: the group and its `+` are matched as the literal string. The change is identical in `vendor/picomatch/lib/parse.js` (4.x) and `vendor/picomatch-v2/lib/parse.js` (2.3.2).
- Groups checked: plain `(...)`, `@(...)`, `!(...)` and comma braces `{a,b}` when followed by `+`.
- When a body counts as risky:
- it contains `*`, ``, a regex `+`, or a nested repeating extglob (`(*a)+`, `(*)+x`, `(a*)+b`, `((*)+)+`, `{*a,}+`, `(a+|b)+`, `(*(a))+b`).
- it has an alternation inside a nested group (`((a|aa))+`).
- its top-level branches are not plain words that join together in only one way (`(a|aa)+`, `(ab|a|ba)+`, `(a|)+`). With `nocase`, branches are lowercased first, so `(A|a)+` counts.
- Negation: `!(...)+` is always treated as risky. Its compiled form ends in `*`, so it took about 5–6 s on 26 characters whatever the body was.
- Unchanged: `(js|ts)+`, `{a,b}+`, `(ab)+`, `([a-z][0-9])+`, `(a?)+`, and anything not followed by `+`. That includes `(*)*x`, whose second `*` is a wildcard rather than a repeat; it stays at about 7 ms on 5,000 characters. `maxExtglobRecursion: false` turns this check off along with the existing guard.
Behaviour change. Glob users who relied on these patterns will now get literal matches. Upstream's own mocha suites (4.0.7 and 2.3.2 tags) still pass except for 9 assertions, up from the 4 already documented. The 5 new ones are all `(a+|b)+`, which took 13 s on 29 characters with the old build. Both READMEs and `docs/dependency-audit-exceptions.md` describe this.
Version bump and lockfile.
- The tarballs were rebuilt with `npm pack` from the source directories and renamed to `…extglobguard.3.tgz`.
- I updated every reference: `package.json` overrides, the lockfile, `THIRD_PARTY_LICENSES.md`, the test and the signed-RPM acceptance files.
- Lockfile integrity was set as the README describes and regenerated with `npm install`. `npm ls` shows no invalid entries.
Tests.
- `test/vendoredPicomatch.test.mjs`: 17/17 pass. The new cases cover each issue pattern against both builds with a 50 ms bound, check that safe groups keep their results, and add a check through the real `anymatch`.
- `npm ci` in a clean copy of the tree succeeded and the same 17 tests pass there.
- `signed-rpm-acceptance-context.test.mjs` passes.
- `npm run test:unit`: 798 of 799 pass. The one failure was caused by my setting `PROPR_DEMO_MODE`; that file passes when rerun without it.
- A fuzz of 200,000 random globs per build found no unintended output changes, no new errors and no slow regexes.
Where controllable globs reach picomatch in ProPR (for the PR description). No ProPR source imports picomatch, micromatch, fast-glob, globby or similar libraries directly. They are reached through two dependencies:
1. `chokidar.watch(...)` in `packages/api/services/taskWatcher.ts:177`, `:233` and `:286` (picomatch via anymatch and readdirp). The watched path is built from the operator's agent config path in the database and a session ID, which comes from `randomUUID()` or the Claude CLI's output stream. No globbing option is turned off, so glob characters in that path would be read as a glob.
2. repomix `pack()` in `packages/core/src/services/context/optimizedContext.ts:63`, `:80` and `:238` (globby → fast-glob → micromatch → picomatch).
- The include patterns are file paths from the cloned repository. Repomix escapes `( ) [ ] \` in them, and fast-glob expands braces before compiling, so a repository file name cannot form a repeated group.
- Repomix also reads the target repository's `.gitignore`, `.ignore` and `.repomixignore`. globby turns those rules into extra skip patterns for fast-glob, but drops any rule containing `(){}|\`.
- `.git/info/exclude` is passed to fast-glob without escaping. A cloned remote can't set that file, but an agent working in the clone could write it.
- Repomix config files in the target repository are not read, because `pack()` is the library API rather than the CLI.
Build-only users: vite, vitest, tailwind, eslint and Playwright configs.
There are no visual previews because nothing user-visible changed.
|
/ultrafix goal=8 max=3 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 3) First action:
|
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
|
Change of direction for this PR, from the author of issue #3728. It replaces the issue's scope and any pending review fixes. GHSA-fc5q-39xc-vjpf was withdrawn on 2026-11-18 ( Please change the PR to do this and nothing else:
Acceptance: |
|
✅ Applied the requested follow-up changes in commit 4cea928 Summary of ChangesI removed the vendored picomatch builds, and ProPR is back on upstream picomatch from the npm registry. A clean What changed
Lockfile (regenerated with
All four come from the registry. The only Audit gates
Other checks
There are no visual previews because nothing user-visible changed. PR description to paste: Closes #3728 GitHub withdrew advisory GHSA-fc5q-39xc-vjpf on 2026-11-18, and the picomatch maintainers say on micromatch/picomatch#273 that it is not a security issue. The two vendored picomatch builds only existed because that advisory had no fixed release. This PR removes them and goes back to upstream picomatch from the npm registry. It also drops this PR's earlier work extending the extglob guard ( Removed
Lockfile: picomatch resolves from the registry only, as 4.0.7 at the root (dev) and 2.3.2 under Audit gates: Verification: a clean 🤖 Generated with Claude Code Review digestRisk-tiered paths
Diff size: 30 files changed, +38/−6,396 lines 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
…on upstream picomatch from the npm registry. A clean `npm ci`, the unit suite (799/799), typecheck and lint all pass. I couldn't change the PR title or description: both `gh pr edit` and the GitHub API returned 403 "Resource not accessible by integration". Please set the title to **Remove the vendored picomatch builds (advisory GHSA-fc5q-39xc-vjpf withdrawn)** and use the description at the end. I removed the vendored picomatch builds, and ProPR is back on upstream picomatch from the npm registry. A clean `npm ci`, the unit suite (799/799), typecheck and lint all pass. I couldn't change the PR title or description: both `gh pr edit` and the GitHub API returned 403 "Resource not accessible by integration". Please set the title to **Remove the vendored picomatch builds (advisory GHSA-fc5q-39xc-vjpf withdrawn)** and use the description at the end. **What changed** - **Guard work dropped.** `vendor/picomatch/`, `vendor/picomatch-v2/`, both tarballs and `test/vendoredPicomatch.test.mjs` are deleted, so the `extglobguard.3` changes go with them. - **`package.json`.** The `"picomatch": "$picomatch"` override and the three nested ones (`anymatch`, `micromatch`, `readdirp`) are gone. The vendoring commit (800738d) was what added picomatch as a direct dependency, so I removed it rather than replacing it with a version range. - **Signed-RPM acceptance files.** The Dockerfile `COPY` lines, the allowlist in `signed-rpm-acceptance-context.mjs` and its test assertions are back to their pre-vendoring braces-only form. - **Docs.** I removed the picomatch section from `docs/dependency-audit-exceptions.md` and the vendored picomatch row from `THIRD_PARTY_LICENSES.md` (MIT count 225 → 224). The notices validator passes. - **`CHANGELOG.md`.** One entry under Unreleased → Removed. - No CI workflow or `.npmrc` referred to the vendored builds. `vendor/braces/` is untouched. **Lockfile** (regenerated with `npm install`; a second run leaves it byte-identical) | Path | Version | |---|---| | `node_modules/picomatch` | 4.0.7 (dev) | | `node_modules/anymatch/node_modules/picomatch` | 2.3.2 | | `node_modules/micromatch/node_modules/picomatch` | 2.3.2 | | `node_modules/readdirp/node_modules/picomatch` | 2.3.2 | All four come from the registry. The only `file:` entry left is the braces tarball. **Audit gates** - `npm audit --omit=dev`: `found 0 vulnerabilities` - `npm run audit:runtime`: `runtime dependency audit passed.` - `npm run desktop:audit:packaging`: `packaging dependency audit passed.` - **"Review dependency changes":** this job compares pushed commits through GitHub's dependency graph, so it can't run locally. As a stand-in, I asked the same API to compare the vendoring commit with its parent. It now lists `[email protected]` and `2.3.2` with no vulnerabilities, so GitHub's data already reflects the withdrawal. The job itself will run on CI after the push. I added no ignore entry. **Other checks** - `git grep -n "extglobguard\|picomatch-v2"` finds matches only in `CHANGELOG.md` history; the lockfile has none. - The 799 unit tests and the signed-RPM context test (5/5) pass. A clean `npm ci` installs only picomatch 4.0.7 and 2.3.2. There are no visual previews because nothing user-visible changed. **PR description to paste:** --- Closes #3728 GitHub withdrew advisory GHSA-fc5q-39xc-vjpf on 2026-11-18, and the picomatch maintainers say on micromatch/picomatch#273 that it is not a security issue. The two vendored picomatch builds only existed because that advisory had no fixed release. This PR removes them and goes back to upstream picomatch from the npm registry. It also drops this PR's earlier work extending the extglob guard (`extglobguard.3`). **Removed** - `vendor/picomatch/`, `vendor/picomatch-v2/`, both tarballs and `test/vendoredPicomatch.test.mjs`. - From `package.json`: the `"picomatch": "$picomatch"` override, the nested `picomatch` overrides under `anymatch`, `micromatch` and `readdirp`, and the direct `picomatch` dependency, which the vendoring commit had added. - The vendored picomatch tarballs from the signed-RPM acceptance Dockerfile, its allowlist and its test, which are back to braces only. - The picomatch section of `docs/dependency-audit-exceptions.md` and the vendored picomatch row in `THIRD_PARTY_LICENSES.md`. `vendor/braces/` and the braces advisories are unchanged. **Lockfile:** picomatch resolves from the registry only, as 4.0.7 at the root (dev) and 2.3.2 under `anymatch`, `micromatch` and `readdirp`. The only `file:` entry left is the braces tarball. **Audit gates:** `npm audit --omit=dev` finds 0 vulnerabilities, and `audit:runtime` and `desktop:audit:packaging` pass. GitHub's dependency-graph compare API lists `[email protected]` and `2.3.2` with no vulnerabilities. No ignore entry was added. **Verification:** a clean `npm ci` succeeds, `test:unit` passes 799/799, and typecheck, lint and `signed-rpm-acceptance-context.test.mjs` pass. `git grep -n "extglobguard\|picomatch-v2"` matches only `CHANGELOG.md` history. 🤖 Generated with [Claude Code](https://claude.com/claude-code) PR: #3735 Comment by: @integry (ID: 7006455579) Model: Claude Opus 5.5
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe diff follows the authorized change of direction: remove picomatch vendoring and restore upstream dependencies. No code blocker is demonstrated, but merge readiness remains unconfirmed because the supplied validation results largely describe the superseded guard implementation. ✅ Upstream resolutions restored — ✅ Docker inputs stay consistent — The signed-RPM context allowlist, Dockerfile and associated tests consistently remove the picomatch tarballs while retaining braces and its integrity checks. ✅ Scoped removal — Vendored sources, tarballs, dedicated tests and documentation are removed; the changelog records the return to upstream. The large deletion matches the revised objective. This was a static review of the supplied code; no commands were run. Current checks show 30 passed, four pending and no failures. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Refresh implementation and validation evidenceThe supplied PR description still describes extending the guard and testing vendored builds. Refresh it to describe removal and include the requested audit/dependency-review results, clean-install validation, unit tests, typecheck, lint and repository search results for the current implementation. Also record the historical basis for removing the direct dependency. This is a review-evidence and metadata follow-up, not a demonstrated changed-code defect; the supplied material does not establish whether those checks were performed after the scope changed. ScoreThe implementation is coherent and appropriately scoped, with no verified regression. Missing validation evidence for the revised objective prevents an unconditional merge recommendation; the four pending checks alone are not the reason for this score. Score: 7/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
|
+ still takes seconds on a 27-character string+ still takes seconds on a 27-character string
+ still takes seconds on a 27-character string+ still takes seconds on a 27-character string
AI Implementation Summary
Closes #3728
Branch:
3728/claude-opus-5-5-vendored-picomatch-a-grou-20261119-0956-nkhCommits: ✅ Changes committed (2ebb7e3)
AI Processing Completed
Execution Details:
Summary:
Both vendored picomatch builds now handle a group followed by
+whose body can match the same text in more than one way. Every pattern from the issue returns in under 1 ms on a 5,000-character non-matching string, in both builds. I rantest:unitand the picomatch tests, not the fullnpm run test:fullsuite.How it works. The existing extglob guard turns a risky
+(...)into literal text, so I did the same here: the group and its+are matched as the literal string. The change is identical invendor/picomatch/lib/parse.js(4.x) andvendor/picomatch-v2/lib/parse.js(2.3.2).(...),@(...),!(...)and comma braces{a,b}when followed by+.*,**, a regex+, or a nested repeating extglob ((*a)+,(*)+x,(a*)+b,((*)+)+,{*a,}+,(a+|b)+,(*(a))+b).((a|aa))+).(a|aa)+,(ab|a|ba)+,(a|)+). Withnocase, branches are lowercased first, so(A|a)+counts.!(...)+is always treated as risky. Its compiled form ends in*, so it took about 5–6 s on 26 characters whatever the body was.(js|ts)+,{a,b}+,(ab)+,([a-z][0-9])+,(a?)+, and anything not followed by+. That includes(*)*x, whose second*is a wildcard rather than a repeat; it stays at about 7 ms on 5,000 characters.maxExtglobRecursion: falseturns this check off along with the existing guard.Behaviour change. Glob users who relied on these patterns will now get literal matches. Upstream's own mocha suites (4.0.7 and 2.3.2 tags) still pass except for 9 assertions, up from the 4 already documented. The 5 new ones are all
(a+|b)+, which took 13 s on 29 characters with the old build. Both READMEs anddocs/dependency-audit-exceptions.mddescribe this.Version bump and lockfile.
npm packfrom the source directories and renamed to…extglobguard.3.tgz.package.jsonoverrides, the lockfile,THIRD_PARTY_LICENSES.md, the test and the signed-RPM acceptance files.npm install.npm lsshows no invalid entries.Tests.
test/vendoredPicomatch.test.mjs: 17/17 pass. The new cases cover each issue pattern against both builds with a 50 ms bound, check that safe groups keep their results, and add a check through the realanymatch.npm ciin a clean copy of the tree succeeded and the same 17 tests pass there.signed-rpm-acceptance-context.test.mjspasses.npm run test:unit: 798 of 799 pass. The one failure was caused by my settingPROPR_DEMO_MODE; that file passes when rerun without it.Where controllable globs reach picomatch in ProPR (for the PR description). No ProPR source imports picomatch, micromatch, fast-glob, globby or similar libraries directly. They are reached through two dependencies:
chokidar.watch(...)inpackages/api/services/taskWatcher.ts:177,:233and:286(picomatch via anymatch and readdirp). The watched path is built from the operator's agent config path in the database and a session ID, which comes fromrandomUUID()or the Claude CLI's output stream. No globbing option is turned off, so glob characters in that path would be read as a glob.repomix
pack()inpackages/core/src/services/context/optimizedContext.ts:63,:80and:238(globby → fast-glob → micromatch → picomatch).( ) [ ] \in them, and fast-glob expands braces before compiling, so a repository file name cannot form a repeated group..gitignore,.ignoreand.repomixignore. globby turns those rules into extra skip patterns for fast-glob, but drops any rule containing(){}|\..git/info/excludeis passed to fast-glob without escaping. A cloned remote can't set that file, but an agent working in the clone could write it.pack()is the library API rather than the CLI.Build-only users: vite, vitest, tailwind, eslint and Playwright configs.
There are no visual previews because nothing user-visible changed.
Review digest
Risk-tiered paths
package-lock.json(+13/−13): lockfilepackage.json(+4/−4): dependency manifestvendor/picomatch-v2/package.json(+1/−1): dependency manifestvendor/picomatch/package.json(+1/−1): dependency manifestapps/desktop/scripts/signed-rpm-acceptance-context.mjs(+2/−2)apps/desktop/scripts/signed-rpm-acceptance.Dockerfile(+2/−2)vendor/picomatch-4.0.8-extglobguard.2.tgz(deleted, +0/−0)vendor/picomatch-4.0.8-extglobguard.3.tgz(added, +0/−0)vendor/picomatch-4.0.8-v2.3.2-extglobguard.2.tgz(deleted, +0/−0)vendor/picomatch-4.0.8-v2.3.2-extglobguard.3.tgz(added, +0/−0)vendor/picomatch-v2/lib/parse.js(+256/−4)vendor/picomatch/lib/parse.js(+256/−4)THIRD_PARTY_LICENSES.md(+1/−1)apps/desktop/scripts/signed-rpm-acceptance-context.test.mjs(+1/−1)docs/dependency-audit-exceptions.md(+7/−5)test/vendoredPicomatch.test.mjs(+47/−2)vendor/picomatch-v2/README.md(+47/−9)vendor/picomatch/README.md(+47/−9)Diff size: 18 files changed, +685/−58 lines
View task for the run's logs and conversation.
This PR was created automatically by ProPR after processing issue #3728.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!