Repository navigation
Dependencies: patched picomatch builds for GHSA-fc5q-39xc-vjpf (no upstream fix yet) - #3678
Conversation
…: a new picomatch advisory, GHSA-fc5q-39xc-vjpf, was published with no fixed release. Locally, both audit gates the job runs (`npm run audit:runtime` and `npm run desktop:audit:packaging`) now pass, and so do the related test suites. CI hasn't run on the change yet. I fixed the failing check. No code on this branch caused it: a new picomatch advisory, GHSA-fc5q-39xc-vjpf, was published with no fixed release. Locally, both audit gates the job runs (`npm run audit:runtime` and `npm run desktop:audit:packaging`) now pass, and so do the related test suites. CI hasn't run on the change yet. **Cause.** The advisory covers every `picomatch` up to 4.0.7, which is the latest release. Patterns like `+(*)` or `+(*a)` make picomatch build a regex that takes exponentially long to fail. I reproduced it: about 35 seconds on a 29-character string, on both 2.3.2 and 4.0.7. `main` has the same problem, so other open branches will fail the same way. Both copies in our tree are affected: 4.0.7 (used by `vite`, `vitest`, `tinyglobby`) and 2.3.2 (used by `micromatch`, `anymatch` and `readdirp`, which `fast-glob`, Repomix and `chokidar` use). **Fix.** I followed the same approach the repo already uses for `braces`: I didn't add an audit exception. Instead both picomatch copies now install from patched versions stored in the repo: - **The patch:** a small check in `lib/parse.js` treats any `+(…)`/`*(…)` pattern containing a bare `*` or `+` as plain text, using picomatch's existing handling for patterns it already considers risky. All the attack patterns now finish in under 2 ms. - **`vendor/picomatch`:** 4.0.7 plus the patch, used by everything that needs picomatch 4. - **`vendor/picomatch-v2`:** 2.3.2 plus the same patch, used by `anymatch`, `micromatch` and `readdirp` (overridden in `package.json`). I kept these on the 2.x code because the 4.x line changed path handling that `micromatch` and `fast-glob` rely on. - **Version numbers:** both versions must sort above 4.0.7 or the audit still flags them, so the 2.x one is named `4.0.8-v2.3.2-extglobguard.1`. - **Lockfile:** npm 10 and npm 11 both kept collapsing the 2.x consumers onto the 4.x copy. I wrote those three lockfile entries by hand. They stay unchanged through `npm install` and lockfile-only installs on both npm versions, and a clean `npm ci` installs the right copy for each package. Other changes: - **Signed-RPM acceptance:** its allowlist and Dockerfile now include the two new tarballs. - **New test:** `test/vendoredPicomatch.test.mjs` checks that the source, tarball, lockfile and installed copies match, and that normal matching still works. - **Docs and notices:** README provenance notes in each vendored folder, a section in `docs/dependency-audit-exceptions.md`, a CHANGELOG Security entry, and a regenerated `THIRD_PARTY_LICENSES.md` (new picomatch row, and the date moves to today). **Behaviour change and remaining risk.** I ran picomatch's own test suite against both patched copies. Four assertions now fail, and each one checks that a vulnerable pattern (`+(*)c`, `*(a*|b)`, `*/*(W*, *)*`) still matches. Those patterns now match only their literal text, and no glob in this repo uses one. Nested repeats like `+(a*(a))` are still slow. I left them alone because picomatch's own tests require the same shape (`*(f*(o))`) to keep working, and upstream tracks that case separately (issue #175). Once picomatch publishes fixed releases, the vendored copies can be removed; the vendored READMEs list the steps. PR: #3630 Comment by: @propr-dev[bot] (ID: 6955352684) Model: Claude Opus 5.5
…red picomatch builds. The flagged regex really was slow: on a string of 65,000 `[` characters, `removeBackslashes` took about 1.6 s. It now takes about 1 ms. CI hasn't run on the change yet. I fixed both CodeQL alerts (#246 and #247) in the two vendored picomatch builds. The flagged regex really was slow: on a string of 65,000 `[` characters, `removeBackslashes` took about 1.6 s. It now takes about 1 ms. CI hasn't run on the change yet. **Cause.** `removeBackslashes` in `lib/utils.js` used upstream's `REGEX_REMOVE_BACKSLASH` (`/(?:\[.*?[^\\]\]|\\(?=.))/g`). From every `[` with no closing `]`, that regex rescans to the end of the line, so the time grows with the square of the input length. **Fix.** In both `vendor/picomatch/lib/utils.js` and `vendor/picomatch-v2/lib/utils.js`, `removeBackslashes` is now a single pass over the string. It returns exactly what the old regex returned: - It returns the input unchanged when there is no backslash, since only backslashes are ever removed. - A text in brackets is kept as is under the same rule the regex used. - A backslash followed by any character other than a line break is removed. `lib/constants.js` is unchanged, so `REGEX_REMOVE_BACKSLASH` is still exported as part of `constants`. `utils.js` just no longer imports it. **Same output as before.** I compared the new function with the old regex on every string up to six characters built from `[`, `]`, `\`, `a`, `*` and the four line terminators, plus 300,000 random strings. There were no differences in either build. **Other changes:** - **Tests:** `test/vendoredPicomatch.test.mjs` has a new check for each build. It compares the function with the upstream regex on every short string, requires the 65,000-character inputs to finish in under 200 ms, and runs a few `scan(..., { unescape: true })` cases. - **Tarballs and lockfile:** I repacked both tarballs and updated the four lockfile integrity entries. Only those integrity lines changed in `package-lock.json`. The version stays `4.0.8-extglobguard.1`, so `npm install` didn't refresh the locally installed copies; I removed them and reinstalled. - **Docs:** both READMEs now say `lib/utils.js` differs from upstream and why. `docs/dependency-audit-exceptions.md` mentions it too. **Checks run:** - `test/vendoredPicomatch.test.mjs`: 11 of 11 pass, including the byte-identity, lockfile-integrity and installed-copy checks. - `apps/desktop/scripts/signed-rpm-acceptance-context.test.mjs`: 5 of 5 pass. It checks the tarballs against the lockfile integrity. - `npm run audit:runtime` and `npm run desktop:audit:packaging` both pass. There's nothing visual in this change, so there are no previews. PR: #3630 Comment by: @github-advanced-security[bot] (ID: 4603531940) Comment by: @github-advanced-security[bot] (ID: 4603532037) Model: Claude Opus 5.5
|
/review |
|
✅ AI Code Review Complete requested by @integry Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe vendoring, dependency wiring, and provenance documentation are thorough, but the new guard misses single-branch wildcard patterns that remain vulnerable to exponential backtracking. Changes are needed before merge. ✅ Installation consistency — Tests compare readable source, tarball contents, lockfile integrity, and installed consumer packages. ✅ Packaging coverage — Both new tarballs are included in the sanitized RPM acceptance context and copied before This review uses static analysis only, as requested. The supplied status reports no failed checks and 17 pending checks. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F1: 🔴 Bracket handling bypasses the wildcard guard
SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Assert literal matching through regexesIn S2: 🟢 Isolate backtracking performance probesThe synchronous timing helper can only check elapsed time after matching returns. Running adversarial probes in a worker or child process with an external timeout would make future regressions fail promptly instead of potentially stalling the suite. This is optional test hardening. ScoreThe packaging and integrity safeguards are strong, but a concrete bypass leaves the targeted single-branch backtracking problem incompletely remediated. The correction is localized to the guard and its regression coverage. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
/ultrafix goal=8 max=3 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 3) First action:
|
|
✅ Applied the requested follow-up changes in commit 7b16ed4
Summary of ChangesThe background job that just stopped was my first timing fuzz, which was cut off at its time limit before finishing. Nothing is lost: a second, faster version replaced it and finished on both builds. It found nothing slow within this fix's scope; the only slow cases left are the three upstream ones I reported. Nothing needs to be rerun, and the fix and its results are unchanged. Review digestRisk-tiered paths
Validation evidence
Diff size: 8 files changed, +114/−12 lines 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
…zz, which was cut off at its time limit before finishing. Nothing is lost: a second, faster version replaced it and finished on both builds. It found nothing slow within this fix's scope; the only slow cases left are the three upstream ones I reported. Nothing needs to be rerun, and the fix and its results are unchanged. The background job that just stopped was my first timing fuzz, which was cut off at its time limit before finishing. Nothing is lost: a second, faster version replaced it and finished on both builds. It found nothing slow within this fix's scope; the only slow cases left are the three upstream ones I reported. Nothing needs to be rerun, and the fix and its results are unchanged. PR: #3678 Comment by: @integry (ID: 6957550230) Model: Claude Opus 5.5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
|
The bracket bypass (F1) is fixed at
So a parenthesised group (plain parens or an Please handle it with the same rule and the same helper the guard already uses: when a closing paren of a single-branch group that contains an unbounded wildcard is followed by Keep it bounded: if this cannot be done as a small extension of the existing guard, do not redesign the parser. Instead document the residual case next to the existing nested-repeat residual and say so in the summary. |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR provides a focused vendored mitigation for both picomatch lines, with dependency overrides, packaging updates, and provenance documentation. Static review found no verified PR-introduced merge blocker. It is merge-ready within scope, conditional on the three pending checks completing successfully. ✅ Artifact consistency checks — Tests compare readable sources, tarballs, lockfile integrity, and consumer-resolved installations for both builds. ✅ Parser-aware guarding — The token-based check supplements source scanning for malformed brackets and swallowed quotes that would otherwise hide live wildcards. ✅ Packaging integration — Both tarballs are included in the signed RPM acceptance context and Dockerfile, with integrity validation before installation. This was a static review of the supplied code; no commands were run or files modified. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S3: 🟢 Assert literal matching directlyIn S4: 🟢 Isolate backtracking performance probesThe synchronous S5: 🟢 Track residual nested repetitionBoth vendored READMEs explicitly document the remaining exponential ScoreThe implementation is coherent within its stated scope and includes substantial artifact and behavior coverage. The supplied current-head status shows no failures, with three checks still pending; runtime results were not independently reproduced during this static review. Score: 8/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
Please implement the request in my previous comment on this PR (the table of |
Why
The picomatch advisory GHSA-fc5q-39xc-vjpf (high, ReDoS through single-branch repeated extglobs such as
+(*)) was updated on 2026-11-17 to cover every published version (<= 4.0.7, the latest). There is no fixed release; upstream fixes are open, unmerged pull requests (micromatch/picomatch #237, #238, #246). Since the update,npm run audit:runtimeandnpm run desktop:audit:packagingfail onmainand on every pull request.What
These are the two commits ProPR's CI follow-up made on the API/core epic (#3630), lifted onto
mainunchanged so the fix can be reviewed and merged on its own:vendor/picomatch, 4.0.7 base, andvendor/picomatch-v2, 2.3.2 base), installed throughpackage.jsonoverrides. Same approach as the existing vendoredbracesbuild.removeBackslashesregex with a linear scan (CodeQL alerts 246 and 247).test/vendoredPicomatch.test.mjsguards the tarballs, the lockfile and the matching behaviour;docs/dependency-audit-exceptions.mdrecords provenance and when to remove it.Checked locally
main.+(*),+(*a)and*(a*)against a 40-character non-matching string return in under 3 ms; ordinary globs, braces and negation still match as before.Remove the vendored builds and overrides when upstream publishes fixed releases.
🤖 Generated with Claude Code