Skip to content

Drop the brace-expansion override: clears GHSA-rgw5-rvv9-x895 and unbreaks test:coverage (closes #1950) - #1949

Merged
malibio merged 2 commits into
mainfrom
fix-brace-expansion-advisory
Aug 3, 2026
Merged

malibio merged 2 commits into
mainfrom
fix-brace-expansion-advisory

Conversation

@malibio

@malibio malibio commented Aug 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Deletes the brace-expansion entry from the root package.json overrides. That single deletion clears a high-severity advisory and fixes bun run test:coverage, which has been broken on main since the pin was introduced.

This supersedes the 1.1.17 → 1.1.18 bump the branch originally carried. Bumping cleared the advisory but left the real defect in place; deleting fixes both. Closes #1950.

Two problems, one cause

overrides applies to the entire tree and cannot express "1.x here, 5.x there". Three consumers declare incompatible ranges, and #1869's pin forced all of them onto 1.x:

consumer declares was forced to
[email protected] ^1.1.7 1.x ✅
[email protected] ^2.0.2 1.x ❌
[email protected] ^5.0.5 1.x ❌

Problem 1 — the advisory. The pin sat at 1.1.17, one patch below GHSA-rgw5-rvv9-x895's floor for the 1.x line (CVE-2026-69152, high, CVSS 7.5). bun audit failed on every open PR.

Problem 2 — test:coverage crashed. [email protected] is CommonJS exporting only a default; minimatch@10 does import { expand }. Reached via test-exclude → minimatch@10 and a braced include glob ({test,spec}):

TypeError: (0 , brace_expansion_1.expand) is not a function
 ❯ braceExpand  [email protected]/dist/commonjs/index.js:157:41

It went unnoticed because test:all runs test, test:scripts, test:skill and rust:test — never test:coverage.

Why deleting is the fix

Upstream has caught up since #1869, so the override is no longer needed. With it gone, natural resolution puts every consumer on its own major, each at or above its patched floor:

resolved floor consumer
[email protected] 1.1.18 [email protected]
[email protected] 2.1.4 [email protected]
[email protected] 5.0.9 [email protected]

That is exactly what resolution did before #1869 — the override was solving a problem that has since solved itself upstream.

Verification

Measured with clean git clone + bun install into a temp dir. Do not read the local node_modules/.bun — it is an accumulating cache that retains copies from earlier installs and will mislead you (it misled both me and the reviewer on the first pass).

resolved copies bun run audit test:coverage
main one, 1.1.17 ❌ fails ❌ TypeError
this PR 1.1.18, 2.1.4, 5.0.9 ✅ clean ✅ runs
  • bun run test:all → 172 files / 4112 tests passing (pre-push gate green)
  • bun run test:coverage → completes, 88.43% lines. Still exits 1 on the 90% global threshold — pre-existing project state, unrelated to this change. The crash is what this fixes; the shortfall is a separate question.

Dead end, recorded

Scoped override keys (test-exclude/minimatch/brace-expansion) were tried first. Bun 1.3.11 silently ignores them: accepted into the lockfile, zero effect on resolution — still one flattened copy. Noting it so nobody retries it.

Scope note

The bun.lock diff is large because removing an override re-resolves the tree. The packages/desktop-app 0.1.0 → 0.2.0 line is bun install syncing a stale lockfile against a manifest already at 0.2.0 on main; not a version bump.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FELy7rhqnKbDmmG9fuHALT



`bun audit` has been failing on every PR: the pinned override sat at 1.1.17,
one patch short of the fix for GHSA-rgw5-rvv9-x895 (high, DoS via unbounded
intermediate arrays, bypassing the CVE-2026-14257 mitigation). The advisory
patches the 1.x line in 1.1.18.

The pin itself is load-bearing and stays: three different minimatch versions in
the tree ask for `^1`, `^2` and `^5` respectively, and the override flattens all
of them to one copy. Bumping the pinned version is therefore the whole fix —
nothing else in the manifest needs to move.

Verified: `bun run audit` clean, one resolved copy at 1.1.18, frontend suite
172 files / 4112 tests passing.

Co-Authored-By: Claude <[email protected]>
@malibio

malibio commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

Code Review — PR #1949

Verdict: APPROVE (merge on its own terms). The change does exactly what it claims, clears a real high-severity advisory, and has zero behavioural delta versus main. Separately, this review surfaced a pre-existing, currently-live defect in the override that predates this PR. It should not block the merge, but it needs its own issue and I'd argue a fairly prompt one — details in Finding 2.

A note on process first: the review went through two wrong turns before landing, and the record should be accurate rather than flattering. I initially read node_modules/.bun in the working checkout and concluded the override wasn't applying. That was wrong — .bun is an accumulating cache (the stray 1.1.13/2.0.3/5.0.5 copies are dated April 1 and predate the pin). The author was right on that mechanism. The author, in turn, initially read the finding as invalidating the concern entirely; that was also wrong, because the underlying ESM/CJS problem is real. Clean-room git clone + bun install into a temp dir settled both halves, and everything below rests on that.


Findings

1. The immediate fix is correct — verified

  • Advisory data checks out. gh api /advisories/GHSA-rgw5-rvv9-x895 returns exactly the table in the PR body: < 1.1.18 vulnerable, 1.1.18 first patched for the 1.x line (also 2.1.4 / 3.0.6 / 5.0.9). CVE-2026-69152, CVSS 7.5 high, not withdrawn. 1.1.18 published 2026-07-30, one day after the 1.1.17 this replaces — consistent with "the pin aged into the flagged version."
  • The override does flatten the tree. Clean-room installs confirm one physical copy, with all three consumers linked to it:
    • PR branch → minimatch@{3.1.5, 9.0.9, 10.2.5} → [email protected], bun run audit passes.
    • main → same three → [email protected], bun run audit fails on this GHSA.
      The ^2.0.2 / ^5.0.5 strings in bun.lock are recorded requests, not resolutions. The overrides block is doing real work.
  • This is a genuine remediation, not silencing the checker. The vulnerable code is actually gone from the tree.

2. [Improvement — pre-existing, not introduced here] Cross-major flattening is live-broken on the coverage path

Forcing 1.1.18 onto consumers that declared ^2 and ^5 is not safe in general, and it is already failing today. This is not theoretical:

  • [email protected] is "type": "module" and its ESM entry opens with import { expand } from 'brace-expansion'. [email protected] is CJS with module.exports = expandTop and no named expand export. The 5.x line exports export function expand(str, options = {}). These are different API shapes, not just different version numbers.
  • ESM entry throws SyntaxError: Named export 'expand' not found.
  • CJS entry throws TypeError: (0, brace_expansion_1.expand) is not a function.

The trigger is narrow, which is why it has gone unnoticed: minimatch@10 works fine for brace-free patterns and only throws when a {a,b} pattern is evaluated.

It is reachable from this repo's own config. [email protected] (vitest coverage) resolves to [email protected] and packages/desktop-app/vitest.config.ts uses 'src/tests/**/*.{test,spec}.{js,ts}'. Reproducing the real call:

new TestExclude({ include: ['src/tests/**/*.{test,spec}.{js,ts}'] })
  .shouldInstrument('src/tests/a.test.ts')
→ TypeError: (0 , brace_expansion_1.expand) is not a function

This fails identically on main and on this PR. It is pre-existing, introduced when the pin was first added in #1869 — not a regression from this bump. bun run test:all passes because it runs test, test:scripts, test:skill, rust:test and does not include test:coverage, so nothing in the gate exercises the path. bun run test:coverage is the exposed surface.

The other consumer, @typescript-eslint/[email protected], calls minimatch only under allowDefaultProject, which does not appear anywhere in this repo's config — so that path is dormant rather than broken.

So the honest framing: this PR is a strict improvement sitting on top of a pre-existing landmine. It clears a real advisory, changes one character, and makes nothing worse. But "the override flattens three majors and that's the whole fix" understates things — the flattening is itself semantically unsound and already costs a broken test:coverage.

Why I'd still merge rather than block: reverting or widening the pin here would restore the high advisory and fix nothing that is currently green, and the coverage break is equally present on main, so blocking buys no safety. Splitting is the right call — but the follow-up shouldn't linger, since the symptom is a confusing expand is not a function in a tool nobody suspects.

Suggested follow-up options for the issue, roughly in order of preference:

  1. Per-consumer major-correct overrides — pin 1.1.18 / 2.1.4 / 5.0.9 on the respective branches so every consumer gets a patched version in its own major. Bun supports scoped override keys (e.g. "test-exclude/minimatch/brace-expansion"). Clears the advisory on all lines and fixes the coverage break.
  2. Bump the consumers so they carry patched versions themselves, then drop the override entirely.
  3. Drop the pin once the transitive tree floats to patched versions naturally — simplest end state, but only viable once every branch is above its floor.

3. [Improvement] The packages/desktop-app 0.1.0 → 0.2.0 lockfile line should be called out, not silently shipped

Your reading is right, and I verified it: packages/desktop-app/package.json is already 0.2.0 on main, while bun.lock still recorded 0.1.0. So bun install corrected a stale lockfile entry; this PR is not performing a version bump, it is recording one that already happened.

That makes it safe, and I would keep it rather than strip it. Stripping means either hand-editing a generated lockfile (bad practice, and it would just resurface on the next unrelated bun install) or leaving a known-stale entry in place. Your instinct to flag rather than bury it is the correct half; the conclusion I'd draw is "harmless lockfile convergence, documented in the PR body," not "remove."

Nit: one line in the PR body's "Verification" section would close the question for the next reader — e.g. "bun.lock also syncs packages/desktop-app to 0.2.0, matching the version already on main; no manifest change."

4. [Improvement] Exact pin vs. range — the maintenance story is the real issue

You asked whether an exact pin is the right mechanism given it has now aged into a vulnerable version once. Directionally I'd keep exact pins, but the current setup has a real gap.

  • Exact pins are the right default for a security override: reproducible, and they can't silently drift.
  • ^1.1.18 would auto-absorb the next 1.x patch, but it cannot solve the actual problem here — no 1.x range reaches the patched 2.x/5.x lines. It converts one class of staleness into a weaker guarantee without fixing the cross-major issue, so it isn't a real upgrade.
  • The genuine gap is notification, not range syntax. This pin sat one patch short until bun audit started failing on unrelated PRs, and the discovery mechanism was "every open PR went red at once." That is a poor signal: it surfaces late, blocks unrelated work, and creates pressure to fix it in whatever branch happened to trip it.

Given the documented no-CI-by-design stance, a scheduled dependency check isn't a natural fit, so the pragmatic version is to make the failure legible rather than automated — the overrides block is currently a bare list with no indication which entries are security pins vs. compatibility pins, or what their patched floors are.

Nit: a brief comment marking the security-motivated entries would help whoever hits this next. package.json disallows comments, so the natural home is a short note in scripts/audit-npm.ts next to the ALLOWLIST, where the "prefer overrides" guidance already lives.

5. Audit tooling — allowlisting would have been the wrong call, and the script says so

Agreed with your judgement, and scripts/audit-npm.ts encodes exactly that rule: the ALLOWLIST is for advisories that are dev/build/test-only or blocked on an upstream major bump, with the header stating "Production advisories are fixed via overrides in the root package.json, not ignored." A patched version existed, so the override was the correct lever and the allowlist would have been an unjustified suppression.

Two things worth noting in the script's favour: it fails closed when bun audit can't run (empty stdout + non-zero exit), which is the right call for a gate; and its failure message points the reader at the override fix first, allowlist second. That guidance is what makes this PR the obvious response — the tool did its job.

One observation rather than a request: brace-expansion reaches the tree only through dev tooling (eslint, vitest coverage, typescript-eslint) — packages/desktop-app's runtime dependencies don't include it, and there's no path into a shipped bundle. So by the script's own taxonomy this was allowlist-eligible. Fixing it properly instead was still the better call, and it happens to be the reason Finding 2 is a broken dev tool rather than a shipped DoS vector.


Summary

Item Assessment
Advisory claim (1.1.18 first patched on 1.x) Verified against the GitHub advisory API
Override actually flattens the tree Verified in clean-room installs of both branches
Fix clears the advisory Verified — audit passes on PR, fails on main
desktop-app 0.1.0 → 0.2.0 Stale-lockfile sync; already 0.2.0 on main; keep, mention in body
Cross-major flattening Pre-existing live defect, breaks test:coverage on main too; own issue
Exact pin mechanism Keep exact; real gap is notification, not range syntax
Allowlist instead? Correctly rejected — a patched version existed

Net: one-character security fix, correctly researched and honestly described, with a bun.lock sync riding along that is safe and worth a sentence in the body. Approving. The flattening defect is the more interesting finding and deserves an issue, but it belongs in its own change, not this one.

@malibio malibio left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE — safe to merge on its own terms. (Posting as a comment rather than --approve since this is a self-authored PR.)

Full review: #1949 (comment)

Verified in clean-room clones of both branches:

  • The advisory table matches gh api /advisories/GHSA-rgw5-rvv9-x895 exactly — 1.1.18 is the first patched 1.x version.
  • The override genuinely flattens all three minimatch majors to one copy: PR → [email protected] with audit passing, main → 1.1.17 with audit failing. Real remediation, not a silenced checker.
  • The packages/desktop-app 0.1.0 → 0.2.0 lockfile line is a stale-lockfile sync — package.json is already 0.2.0 on main. Safe; keep it, and add a sentence to the PR body rather than stripping it.

One finding worth its own issue, not a blocker: forcing 1.1.18 onto the ^2/^5 consumers is semantically unsound and is already live-broken. [email protected] does import { expand } from 'brace-expansion', but 1.x is CJS with module.exports = expandTop and no named expand. Via test-exclude and this repo's own 'src/tests/**/*.{test,spec}.{js,ts}' glob, that throws TypeError: (0, brace_expansion_1.expand) is not a function whenever a brace pattern is evaluated.

Crucially this fails identically on main — it dates to the original pin in #1869, not to this bump. test:all stays green because it excludes test:coverage. So this PR is a strict improvement on top of a pre-existing landmine; blocking it would restore the high advisory and fix nothing. Follow-up options, preferred first: per-consumer major-correct overrides (1.1.18/2.1.4/5.0.9), bump the consumers, or drop the pin once the tree floats to patched versions.

Not merging — that call is yours.

@malibio

malibio commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

Review addressed. Verdict was APPROVE (merge on its own terms) with the flattening defect split out.

Finding 2 — verified and filed as #1950. I reproduced the reviewer's claim end-to-end on a clean clone of main rather than taking it on trust, and it is worse than I described in the PR body: not latent, but currently live. bun run test:coverage fails on main today:

TypeError: (0 , brace_expansion_1.expand) is not a function
 ❯ braceExpand   node_modules/.bun/[email protected]/.../dist/commonjs/index.js:157:41

It went unnoticed because test:all runs test, test:scripts, test:skill and rust:test — not test:coverage — so the pre-push gate never touches it. Filed with repro, cause, three fix options, and an open question about whether test:coverage belongs in the gate.

Finding 3 — kept, and the PR body already documents it ("Scope note"): the packages/desktop-app 0.1.0 → 0.2.0 line is bun install syncing a stale lockfile against a manifest already at 0.2.0 on main. Agreed that stripping it would mean hand-editing a generated file for no gain.

Findings 4 and 5 — no change here. The notification-vs-range point is real but belongs with #1950's decision about the override block as a whole rather than being pre-empted by a one-line comment in this PR. Agreed the allowlist would have been the wrong lever: a patched version existed, and the script's own guidance says so.

On the record: the review went through two wrong turns — mine and the reviewer's — both from reading node_modules/.bun, which is an accumulating cache rather than a resolved tree. Everything asserted here now rests on clean git clone + bun install into a temp dir. Worth remembering next time a dependency question comes up in this repo.

No code changes. Ready to merge; the flattening fix is #1950's.

…break test:coverage

Supersedes the 1.1.17 -> 1.1.18 bump this branch originally carried. Deleting the
override, rather than bumping it, fixes both problems at once.

The pin was added in #1869 to clear an advisory, but `overrides` applies to the
whole tree and cannot express "1.x here, 5.x there". Three consumers declare
incompatible ranges, so all three were forced onto 1.x:

  [email protected]  wants ^1.1.7   ok
  [email protected]  wants ^2.0.2   forced to 1.x
  [email protected] wants ^5.0.5   forced to 1.x  <- broken

brace-expansion 1.x is CommonJS exporting only a default; minimatch@10 imports a
named `expand`. So `bun run test:coverage` has been dead since #1869 with
`TypeError: (0 , brace_expansion_1.expand) is not a function`, reached via
test-exclude -> minimatch@10 and a braced include glob (`{test,spec}`). It went
unnoticed because test:all runs test, test:scripts, test:skill and rust:test —
never test:coverage.

Upstream has since caught up, so the override is no longer needed at all. With it
removed, natural resolution puts every consumer on its own major, each at or
above this advisory's patched floor:

  [email protected]  (floor 1.1.18)
  [email protected]   (floor 2.1.4)
  [email protected]   (floor 5.0.9)

Verified in clean clones: `bun run audit` clean, and `test:coverage` runs to
completion (172 files / 4112 tests, 88.43% lines). It still exits 1 on the 90%
global threshold, which is pre-existing project state and unrelated to this
change — the crash is what this fixes.

Scoped override keys (`test-exclude/minimatch/brace-expansion`) were tried first
and are silently ignored by Bun 1.3.11: accepted into the lockfile, no effect on
resolution. Recorded so the next person does not retry it.

Co-Authored-By: Claude <[email protected]>
@malibio malibio changed the title Bump the brace-expansion override to 1.1.18 to clear GHSA-rgw5-rvv9-x895 Drop the brace-expansion override: clears GHSA-rgw5-rvv9-x895 and unbreaks test:coverage (closes #1950) Aug 3, 2026
@malibio
malibio merged commit 703b2af into main Aug 3, 2026
2 checks passed
@malibio
malibio deleted the fix-brace-expansion-advisory branch August 3, 2026 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

brace-expansion override forces one major onto three consumers, breaking test:coverage

1 participant