Skip to content

chore: resolve reported dependency security advisories#1409

Merged
dannyhw merged 2 commits into
mainfrom
chore/security-audit-fixes
Jul 26, 2026
Merged

chore: resolve reported dependency security advisories#1409
dannyhw merged 2 commits into
mainfrom
chore/security-audit-fixes

Conversation

@dannyhw

@dannyhw dannyhw commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

Brings pnpm audit from 150 advisories (3 critical / 70 high / 67 moderate / 10 low) down to 4 (3 high / 1 moderate).

Why there was so much to fix

Most findings were stale lockfile resolutions, not real version constraints — the committed lockfile held transitive dependencies well below what their parents' declared ranges already allowed. Re-resolving in range cleared the bulk of them with no overrides at all.

One gotcha worth recording: deleting pnpm-lock.yaml is not enough to force re-resolution. pnpm falls back to its virtual-store copy at node_modules/.pnpm/lock.yaml, so both have to be removed.

Published packages

  • dev-server raises @fastify/middie, fastify, http-proxy-middleware, launch-editor and ws. This also clears path-to-regexp, find-my-way and fast-uri transitively.
  • repack raises image-size, and pins terser-webpack-plugin to 5.5.0 — see below.

Everything stays within existing majors, so there are no API changes.

terser-webpack-plugin is pinned to 5.5.0

This started as a bump to ^5.6.1 (5.6+ dropped the vulnerable serialize-javascript). That was wrong — it walks straight into #1390. Confirmed against the tester app:

index.bundle flag
main 2.55 MiB [minimized]
with ^5.6.1 7.36 MiB none

It affected webpack as well as Rspack. And a plain revert to ^5.3.14 isn't sufficient — that range permits 5.6.1, so any fresh install lands on the broken version. main only avoids it through a stale lockfile entry, which is the underlying cause of #1390.

5.5.0 is the last release before the regression, and serialize-javascript was already dropped in 5.3.17 — so a single known-good version fixes the advisory with no override and no upper-bound range to explain. Verified minifier output is unchanged from main by pinning to main's exact 5.3.16 as a control: identical size, miniapp chunk 975 bytes vs 979 before.

Note this pin only governs the fallback copy: getMinimizerConfig prefers a terser-webpack-plugin in the project root, so a consumer who has 5.6.x of their own still hits #1390. A real fix still needs the Rspack SWC minimizer path, or a version check that warns.

Minification is now actually tested

bundle.test.ts only compared emitted filenames, so a no-opping minimizer passed silently — which is why this nearly shipped. It now asserts the output is minified, verified in both directions: ~1.1M chars/line when minified, 44.5 with 5.6.1 forced (fails on all four bundler/platform combos).

Overrides

Only where a parent pins an exact version, so no upgrade can reach the fix. @module-federation/dts-plugin pins koa: 2.15.3, ws: 8.18.0 (0.8.9, via repack's devDependency) and adm-zip: 0.5.10 (2.8.0). Every 0.x dts-plugin release pins ws: 8.18.0 exactly, so moving within 0.x wouldn't avoid them. koa and ws stay within their installed major; adm-zip 0.6.0 is a major only because it raises the required Node version — its API is 0.5.18's plus applyDirAttributes, nothing removed.

Two other versions held back

Both commented at their definition:

  • @rspack/core pinned to 1.6.0. Measured per version:
rspack type errors snapshot-only diffs real assertion failures
1.6.0 0 0 0
1.6.1 0 7 0
1.6.2 0 4 2
1.6.3 0 4 2
1.6.4 3 2
1.7.x 3 polyfills runtime module absent

From 1.6.2 onward repack's Module Federation v2 polyfill startup ordering assertions genuinely fail, 1.6.4+ additionally fails build:ts, and on 1.7.x webpack/runtime/repack/polyfills is missing from the bundle entirely. Only 1.6.0 is fully green; 1.6.1 differs in snapshot text alone. Worth folding into the Rspack 2 work.

  • webpack held on 5.105.x. 5.106.0 removed the internal webpack/lib/util/create-schema-validation, replacing it with a public validate option and an in-plugin validation API (webpack#20275). @module-federation/enhanced below 2.4.0 deep-imports the removed path via normalizeWebpackPath, so builds throw MODULE_NOT_FOUND. Verified with a real webpack 5.109.0 build: MF 2.0.1 fails, MF 2.8.0 builds fine. MF fixed this in 2.4.0, so it is not a repack limitation and needs no upstream report — the hold exists only because repack's MF devDependency is 0.8.9 and tests/integration deliberately pins 0.15.0 / 0.21.0 / 2.0.1 as a compatibility matrix. Users on MF >= 2.4.0 can use webpack 5.106+.

The website also pins @callstack/rspress-preset/-theme to 0.6.0; 0.6.7 drops its require export condition and fails the docs build.

memfs floats again — its Volume#toTree() ordering change is cosmetic, so the two affected assets-loader snapshots are updated rather than pinning around it. Recorded file sets are unchanged.

Remaining four have no reachable fix

  • react-router needs 8.3.0, but react-router-dom@7.18.1 pins react-router: 7.18.1 exactly, and even the latest @rspress/core is still on react-router-dom: ^7.18.1. The advisory covers RSC mode, which a static docs site doesn't use.
  • brace-expansion is patched only in 5.0.8, whose CommonJS build exports a named expand instead of assigning module.exports. minimatch 3.x/8.x call the module directly, so an override throws at require time. Reaching it needs minimatch 10, but @babel/cli pins glob 7 and babel-plugin-module-resolver pins glob 9 — both already at their latest release.
  • uuid in xcode doesn't apply: the advisory covers v3/v5/v6 when buf is passed, and xcode only calls uuid.v4(). An override also wouldn't change what repack-init consumers resolve.

Follow-up

repack's MF devDependency stays at 0.8.9. Moving to 2.x would drop the koa/ws overrides, but MF 2.x renamed the runtime types (FederationRuntimePluginModuleFederationRuntimePlugin, FederationHostFederation) and those names are re-exported from repack's published .d.ts, so it would break typings for anyone on MF 0.x/1.x against the current >=0.6.10 peer range. The better fix is to stop re-exporting MF's types from repack's public surface.

Verification

build 7/7, typecheck 11/11, test 10/10 — matching main, now including the minification assertion.

@changeset-bot

changeset-bot Bot commented Jul 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9835deb

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

This PR includes changesets to release 6 packages
Name Type
@callstack/repack Patch
@callstack/repack-dev-server Patch
@callstack/repack-plugin-expo-modules Patch
@callstack/repack-plugin-nativewind Patch
@callstack/repack-plugin-reanimated Patch
@callstack/repack-init 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

@vercel

vercel Bot commented Jul 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
repack-website Ready Ready Preview, Comment Jul 26, 2026 6:25pm

Request Review

Takes `pnpm audit` from 150 advisories (3 critical / 70 high / 67 moderate /
10 low) down to 4 (3 high / 1 moderate).

Most findings were stale lockfile resolutions rather than genuine version
constraints: the committed lockfile pinned transitive dependencies well below
what their parents' declared ranges already permitted. Note that deleting
`pnpm-lock.yaml` alone is not enough to re-resolve, because pnpm falls back to
its virtual-store copy at `node_modules/.pnpm/lock.yaml`; both must be removed.
Re-resolving in range fixed the bulk of the advisories on its own, without any
overrides.

Published packages:

- dev-server raises `@fastify/middie`, `fastify`, `http-proxy-middleware`,
  `launch-editor` and `ws` to patched versions. This also clears the
  `path-to-regexp`, `find-my-way` and `fast-uri` findings transitively.
- repack raises `image-size`, and pins `terser-webpack-plugin` to 5.5.0. It
  dropped the vulnerable `serialize-javascript` in 5.3.17, so no override is
  needed, and 5.5.0 is the last release before 5.6.0 silently stopped minifying
  (#1390) - the previous `^5.3.14` range allowed that version through. Minifier
  output is unchanged from `main`: the miniapp chunk is 975 bytes here against
  979 before.

Root and validation surfaces:

- `@babel/*` to 7.29.7 (`@babel/helpers`, `@babel/runtime`,
  `@babel/plugin-transform-modules-systemjs`), `turbo` to 2.10.6 and
  `@changesets/cli` to 2.31.1 (`js-yaml`).
- tester-app raises `postcss`; tester-federation-v2 moves Module Federation to
  2.8.0, whose `dts-plugin` no longer depends on `koa`, `axios` or `log4js`, and
  pins a patched `ws`.

The bundle test now asserts that production output is actually minified. It only
compared emitted filenames before, so a no-opping minimizer passed silently;
the new check fails at an average line length of ~45 and passes at ~1.1M.

Overrides are used only where a parent pins an exact version, so no upgrade can
reach the fix. `@module-federation/dts-plugin` pins `koa: 2.15.3`, `ws: 8.18.0`
(0.8.9, via repack's devDependency) and `adm-zip: 0.5.10` (2.8.0). Every 0.x
dts-plugin release pins `ws: 8.18.0` exactly, so moving within 0.x would not
remove the need for these. koa and ws stay within their installed major. adm-zip
0.6.0 is a major only because it raises the required Node version - its API is
0.5.18's plus `applyDirAttributes`, with nothing removed - and adm-zip is
dev-only here.

`memfs` floats again; the `Volume#toTree()` ordering change it introduces is
cosmetic, so the two affected assets-loader snapshots are updated instead of
pinning around it. The recorded file sets are unchanged.

Two bundler versions are held, both commented at their definition. In both cases
the previous range already allowed the broken versions, so this closes a hole
rather than adding caution:

- `@rspack/core` pinned to 1.6.0. Measured per version: 1.6.1 differs only in
  snapshot text, but 1.6.2 and 1.6.3 fail repack's Module Federation v2 polyfill
  startup ordering assertions, 1.6.4+ additionally fails `build:ts` (3-6 type
  errors), and on 1.7.x the `webpack/runtime/repack/polyfills` runtime module is
  absent entirely. Only 1.6.0 is green, and the old `^1.6.0` resolved to 1.7.12
  on a fresh install.
- `webpack` held on 5.105.x. 5.106.0 removed the internal
  `webpack/lib/util/create-schema-validation`, replacing it with a public
  `validate` option and an in-plugin validation API (webpack#20275).
  `@module-federation/enhanced` below 2.4.0 deep-imports the removed path, so
  builds throw MODULE_NOT_FOUND - verified against webpack 5.109.0 with MF 2.0.1
  (fails) and MF 2.8.0 (builds). MF fixed this in 2.4.0, so the hold is only
  needed because repack's MF devDependency is 0.8.9 and tests/integration pins
  0.15.0 / 0.21.0 / 2.0.1 as a compatibility matrix.
- website pins `@callstack/rspress-preset`/`-theme` to 0.6.0; 0.6.7 drops its
  `require` export condition and fails the docs build.

The remaining four advisories have no reachable fix:

- `react-router` needs 8.3.0, but `react-router-dom@7.18.1` pins
  `react-router: 7.18.1` exactly and even the latest `@rspress/core` is still on
  `react-router-dom: ^7.18.1`. The advisory covers RSC mode, which a static docs
  site does not use.
- `brace-expansion` is patched only in 5.0.8, whose CommonJS build exports a
  named `expand` rather than assigning `module.exports`. minimatch 3.x/8.x call
  the module directly, so an override would throw at require time. Reaching it
  needs minimatch 10, but `@babel/cli` pins glob 7 and
  `babel-plugin-module-resolver` pins glob 9, and both are already at their
  latest release.
- `uuid` in `xcode` does not apply: the advisory covers v3/v5/v6 when `buf` is
  passed, and `xcode` only calls `uuid.v4()`. Overriding it would not change
  what consumers of repack-init resolve anyway.

Verified: build 7/7, typecheck 11/11, tests 10/10.
@dannyhw
dannyhw merged commit 742d575 into main Jul 26, 2026
10 checks passed
@dannyhw
dannyhw deleted the chore/security-audit-fixes branch July 26, 2026 18:28
dannyhw added a commit that referenced this pull request Jul 26, 2026
Clears the reported advisories that were still outstanding after #1409.

Example apps (Ruby):
- addressable 2.8.6 -> 2.9.0 and concurrent-ruby 1.3.1 -> 1.3.8 in all
  three tester Gemfile.lock files. Verified with `bundle exec pod install`
  on each app.

Workspace overrides (JavaScript):
- esbuild <0.25 -> ^0.25.0. Only reachable through
  @modern-js/node-bundle-require inside @module-federation/cli, which has
  no release carrying the fix.
- uuid 7 -> ^11.1.1. xcode pins uuid to ^7 and is unmaintained; it only
  calls uuid.v4(), which the advisory does not cover either way.

No shipped package manifest changes, so published dependency ranges are
untouched.

Three advisories are left open because no fix is reachable without
breaking something:
- activesupport (GHSA-2j26-frm8-cmj9, GHSA-cg4j-q9v8-6v38,
  GHSA-89vf-4333-qx8v): the lowest patched release is 7.2.3.1, which needs
  Ruby >= 3.1. The testers pin Ruby 2.7.6, and moving them to 3.3.10 makes
  `pod install` fail with "pathname contains null byte" on every CocoaPods
  release from 1.15.2 through 1.17.0 (CocoaPods#12798, CocoaPods#12866).
- brace-expansion (GHSA-mh99-v99m-4gvg): only 5.0.8 is patched, and it
  switched to a named `expand` export, so minimatch 3.x/8.x break under an
  override. Dev-only here - it is absent from every shipped package's
  production graph.
- react-router (GHSA-qwww-vcr4-c8h2): patched only in 8.3.0.
  react-router-dom has no 8.x line, and @rspress/core 2.0.18 still requires
  react-router-dom ^7.18.1. Website-only, and the advisory covers RSC
  server mode, which a static Rspress build does not use.
dannyhw added a commit that referenced this pull request Jul 26, 2026
The dependency refresh in #1409 broke the Node 18 cell of the main test
matrix. Two caret ranges floated across a Node-version boundary:

- vite 7.3.1 -> 8.1.5. Vite 8 is rolldown-based, and rolldown imports
  `styleText` from `node:util` (added in Node 20.12), so vitest died at
  startup with a SyntaxError before running a single test.
- @rsdoctor/rspack-plugin 1.5.2 -> 1.6.1, which pulls rslog 2.3.0. That
  hard-throws "Unsupported Node.js version" on Node < 20.19 at import
  time, taking down the tester-app bundle tests.

Hold both back: a `vite: ^7.3.1` override and an exact @RSdoctor pin in
the three tester apps. vitest itself stays current at 4.1.10 - it only
needed vite held underneath it, not pinning of its own.

Also extend the matrix to Node 26 and disable fail-fast. The Node 18
failure had cancelled the 20/22/24 jobs mid-run, so the matrix reported
four broken versions when only one was actually broken.

Verified locally with `TURBO_FORCE=true pnpm test`, full suite per
version: 18.20.8, 20.20.2, 22.22.3, 24.14.1 and 26.5.0 all pass 10/10
tasks.

The held versions do not weaken the security posture restored in #1409:
`pnpm audit` reports the same 3 advisories as main, and koa, ws, adm-zip
and caniuse-lite all resolve to identical versions.
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.

1 participant