Skip to content

chore(cli): Upgrade minimatch to v10#127

Open
Alex Yang (himself65) wants to merge 1 commit into
swc-project:mainfrom
himself65:bump-minimatch-v10
Open

chore(cli): Upgrade minimatch to v10#127
Alex Yang (himself65) wants to merge 1 commit into
swc-project:mainfrom
himself65:bump-minimatch-v10

Conversation

@himself65

Copy link
Copy Markdown

Description

@swc/cli pins minimatch: ^9.0.3, which resolves brace-expansion v2. Every v2 release is affected by CVE-2026-14257 (HIGH) — expand() bounds the number of results but not their length, so ~7.5 KB of input can crash the process with a fatal, uncatchable OOM.

The fix exists only on the brace-expansion v5 line, and v5 cannot be forced onto minimatch v9: v3 moved expand from a default export to a named one, and minimatch ≤9 calls it as _brace_expansion.default(pattern). So consumers cannot resolve this with an override — minimatch v10 is the first release that picks up the patched line, which makes this bump the only route.

@swc/cli currently sits at the end of that chain for anyone whose scanner walks the lockfile. It's the last package in my dependency graph still holding brace-expansion v2; @electron/universal and filelist have already moved.

Why v10 is safe here

Per minimatch's changelog, v10.0's only breaking change is Require node 20 or 22 and higher. packages/cli/package.json already declares "node": ">= 20.19.0", so the floor is satisfied.

The API surface used in src/swc/sources.ts is the minimatch(path, pattern) named export, unchanged since v9 (v9.0 was the release that dropped the default export). No source changes are needed.

Verification

Note that the existing suite does not cover the --only / --ignore code paths that call minimatch, so a green run alone doesn't prove much here. I checked the behaviour directly as well:

  • pnpm test in packages/cli — 6 suites, 37 tests, all pass (identical to the pre-change baseline)
  • pnpm types (tsc) — clean
  • Differential test of v9.0.3 vs v10.2.5 across 182 pattern/path pairs shaped like real swc --only / --ignore usage — globstars, brace sets, extglobs (!(...), @(...), +(...), ?(...)), dotfiles, node_modules excludes — 0 behavioural differences
  • Confirmed the resolved tree now uses minimatch@10.2.5brace-expansion@5.0.8 (patched)

Lockfile delta is 28 lines and purely additive (minimatch@10.2.5, brace-expansion@5.0.8, balanced-match@4.0.4).

Note

The one-line whitespace change at the end of packages/cli/package.json (adding the missing trailing newline) was made automatically by the repo's own lint-staged + prettier pre-commit hook, not by hand. Happy to strip it if you'd rather keep the diff to a single line.

A changeset is included (patch for @swc/cli).

`@swc/cli` pins `minimatch: ^9.0.3`, which resolves `brace-expansion` v2.
Every v2 release is affected by CVE-2026-14257, and the fix exists only on
the v5 line, which `minimatch` picks up from v10.

v10's only breaking change is the Node floor (>= 20), and `@swc/cli` already
declares `node: >= 20.19.0`. The `minimatch(path, pattern)` named export used
in `src/swc/sources.ts` is unchanged.
@changeset-bot

changeset-bot Bot commented Jul 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 38b70da

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@swc/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedminimatch@​10.2.510010010088100

View full report

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 38b70da372

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment thread packages/cli/package.json
"@xhmikosr/bin-wrapper": "^14.0.0",
"commander": "^8.3.0",
"minimatch": "^9.0.3",
"minimatch": "^10.2.5",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Exclude Node 21 from the supported engine range

When a consumer installs @swc/cli on Node 21 with strict engine validation, this dependency makes installation fail: the lockfile declares minimatch@10.2.5 supports 18 || 20 || >=22, and its brace-expansion@5.0.8 dependency supports 20 || >=22, while this package still advertises every version >=20.19.0, including Node 21. Align the package's engine range with the new dependency or choose a dependency version that supports the advertised range.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you reflect this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants