Repository navigation
chore(cli): Upgrade minimatch to v10 - #127
Alex Yang (himself65) wants to merge 3 commits into
Conversation
`@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 detectedLatest commit: d79d193 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
💡 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".
| "@xhmikosr/bin-wrapper": "^14.0.0", | ||
| "commander": "^8.3.0", | ||
| "minimatch": "^9.0.3", | ||
| "minimatch": "^10.2.5", |
There was a problem hiding this comment.
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 👍 / 👎.
|
There's now also a direct CVE inside 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>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour 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. |
|
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. |
Description
@swc/clipinsminimatch: ^9.0.3, which resolvesbrace-expansionv2. 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-expansionv5 line, and v5 cannot be forced ontominimatchv9: v3 movedexpandfrom a default export to a named one, andminimatch≤9 calls it as_brace_expansion.default(pattern). So consumers cannot resolve this with an override —minimatchv10 is the first release that picks up the patched line, which makes this bump the only route.@swc/clicurrently sits at the end of that chain for anyone whose scanner walks the lockfile. It's the last package in my dependency graph still holdingbrace-expansionv2;@electron/universalandfilelisthave 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.jsonalready declares"node": ">= 20.19.0", so the floor is satisfied.The API surface used in
src/swc/sources.tsis theminimatch(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/--ignorecode paths that callminimatch, so a green run alone doesn't prove much here. I checked the behaviour directly as well:pnpm testinpackages/cli— 6 suites, 37 tests, all pass (identical to the pre-change baseline)pnpm types(tsc) — cleanswc --only/--ignoreusage — globstars, brace sets, extglobs (!(...),@(...),+(...),?(...)), dotfiles,node_modulesexcludes — 0 behavioural differencesminimatch@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 ownlint-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 (
patchfor@swc/cli).