Skip to content

chore(cli): Upgrade minimatch to v10 - #127

Closed
Alex Yang (himself65) wants to merge 3 commits into
swc-project:mainfrom
himself65:bump-minimatch-v10
Closed

Alex Yang (himself65) wants to merge 3 commits 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.5 → brace-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: d79d193

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 Outdated
"@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?

@simonhammes

Copy link
Copy Markdown

There's now also a direct CVE inside minimatch: CVE-2026-118764 (patched in v11.0.1)

Alex Yang (@himself65) Are you still working on this?

Keep main's minimatch ^11.0.1 and lockfile; they supersede the v10 bump.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
minimatch 11 supports 18 || 20 || >=22 and its brace-expansion
dependency supports 20 || >=22, so Node 21 fails strict engine checks
even though the package advertised every version >= 20.19.0.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T03:53:05.252351Z d79d193 New commits
ℹ️ About Codex in GitHub

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

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

This repository accepts pull requests from approved contributors, users with write access, and bot accounts. Your account is not currently on the approved contributor list, so this pull request is being closed automatically.

Thank you for your interest in contributing to SWC. This notice intentionally asks you to open an issue instead of contacting the maintainers. We do not add new accounts to the approved contributor list unless there are truly exceptional circumstances, so please do not leave comments or send messages that ask us to add your account. Also, our repository guidelines tell us not to use code from forks or fixes linked in comments, and reviewing such code takes a large amount of maintainer time. Because of this, links to forks or fixes do not help the project, so please do not post them in issues or pull requests. We appreciate your understanding.

Please open an issue describing the bug or proposed improvement instead of submitting a pull request.

@github-actions github-actions Bot closed this Nov 19, 2026
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.

3 participants