Skip to content

fix(deps): lift the zod copy of @strapi/utils to 4.6.7 (GHSA-mrhx-c7xc-m3w5) - #15

Merged
Schero94 merged 1 commit into
mainfrom
fix/zod-ghsa-mrhx
Nov 19, 2026
Merged

Schero94 merged 1 commit into
mainfrom
fix/zod-ghsa-mrhx

Conversation

@Schero94

Copy link
Copy Markdown
Owner

What

Fixes Dependabot alert #3 (high): zod GHSA-mrhx-c7xc-m3w5, a large array can exhaust memory during validation (< 4.6.6, patched in 4.6.6).

Path

  • The plugin's own zod (dependencies.zod ^4.6.7) was already 4.6.7, and every array schema in server/src/validation.ts has a .max().
  • The vulnerable copy was zod 4.4.3, pinned exactly by @strapi/utils 5.63.0, which is a runtime dependency of the plugin (npm explain: @strapi/utils@5.63.0 → zod@4.4.3, plus the dev-only @strapi/* packages under @strapi/strapi). @strapi/utils@latest (5.63.0) still pins 4.4.3, so a range bump cannot fix it.

Change

  • package.json: "overrides": { "zod@4.4.3": "^4.6.7" }, the same targeted override used by strapi-auto-uuid and Magic Link. Within zod 4, but it replaces an exact pin, so the full suite was run against it.
  • package-lock.json: the nine nested @strapi/*/node_modules/zod 4.4.3 entries are removed; every zod 4 dedupes to 4.6.7. No other lockfile drift. zod 3.25.76 (koa-body and koa-session under the @strapi/strapi devDependency) remains: dev-only, and no patched 3.x exists.
  • tests/package.test.cjs DEP-02: it was written first and failed before the fix. It fails if any zod 4 below 4.6.6 comes back into the lockfile, or if a zod 3 copy becomes a runtime dependency.
  • CHANGELOG.md [Unreleased] / Security: the fix, plus a note for host apps. npm reads overrides only in the root project, so a Strapi 5.63 app keeps zod 4.4.3 for its own @strapi/* packages until Strapi raises the pin. Apps can add the same override themselves and test it (zod 4.5 made some string formats stricter).

Release

fix(deps): makes semantic-release publish a patch (4.0.5) when this is squash-merged with this title. For consumers, the effect is the changelog guidance and a patched lockfile. Their own install still resolves zod through their Strapi app.

Docs read

  • Advisory GHSA-mrhx-c7xc-m3w5 (GitHub advisory API, 2026-11-19)
  • zod release notes v4.4.3 → v4.6.7 (github.com/colinhacks/zod/releases): 4.5.0 stricter string formats and code-point length; 4.6.0 frozen CommonJS exports; 4.6.6 "check array, set and map size bounds before parsing elements" (#6652)
  • npm overrides (docs.npmjs.com/cli/v10/configuring-npm/package-json#overrides)

Verification (local, Node 22.23)

  • npm ci --legacy-peer-deps with npm 10.9.8 and with npm 11.21.2: clean, and the lockfile is unchanged afterwards
  • lint, format:check, test (122/122), test:admin, test:ts:front, test:ts:back, build, verify, verify:runtime: all exit 0
  • npm audit --omit=dev: 0 vulnerabilities

Not in this PR (dev-only alerts, dismissed separately)

minimatch GHSA-g3hv-75wg-m249, @hono/node-server GHSA-rmxm-3fg6-px4f and react-router GHSA-wrjc-x8rr-h8h6 / GHSA-337j-9hxr-rhxg have no fix that the declaring packages allow. Their reasons are on the alerts.

🤖 Generated with Claude Code

…c-m3w5)

zod < 4.6.6 collects one issue per failing array element without a cap,
so a large array can exhaust memory (GHSA-mrhx-c7xc-m3w5, high). The
plugin's own validation already used zod ^4.6.7; the vulnerable copy was
zod 4.4.3, pinned exactly by @strapi/utils 5.63.0, which is a runtime
dependency of the plugin.

- package.json: overrides { "zod@4.4.3": "^4.6.7" }, the same targeted
  override strapi-auto-uuid and Magic Link use. Lockfile: the nine nested
  @strapi/*/node_modules/zod 4.4.3 entries are gone, all zod 4 dedupes to
  4.6.7. zod 3.25.76 (koa-body, koa-session under the @strapi/strapi
  devDependency) stays: dev-only, no patched 3.x exists.
- tests/package.test.cjs DEP-02 fails when a zod 4 below 4.6.6 returns.
- CHANGELOG [Unreleased] Security: what changed and how a host app can
  apply the same override (npm ignores overrides of dependencies).

Docs read: advisory GHSA-mrhx-c7xc-m3w5 (GitHub advisory API), zod
release notes v4.4.3..v4.6.7 (github.com/colinhacks/zod/releases; 4.5.0
stricter string formats, 4.6.0 frozen CJS exports, 4.6.6 array/set/map
size bounds checked before parsing), npm overrides
(docs.npmjs.com/cli/v10/configuring-npm/package-json#overrides).

Verified with npm 10.9.8 and npm 11.21.2 (npm ci), Node 22.23: lint,
format:check, test (122/122), test:admin, test:ts:front, test:ts:back,
build, verify, verify:runtime; npm audit --omit=dev: 0 vulnerabilities.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Schero94
Schero94 merged commit 3014725 into main Nov 19, 2026
6 checks passed
@Schero94
Schero94 deleted the fix/zod-ghsa-mrhx branch November 19, 2026 21:57
github-actions Bot pushed a commit that referenced this pull request Nov 19, 2026
## [4.0.5](v4.0.4...v4.0.5) (2026-11-19)

### Bug Fixes

* **deps:** lift the zod copy of @strapi/utils to 4.6.7 (GHSA-mrhx-c7xc-m3w5) ([#15](#15)) ([3014725](3014725))

### Security

* zod [GHSA-mrhx-c7xc-m3w5](GHSA-mrhx-c7xc-m3w5) (a large array can exhaust memory during validation; fixed in zod 4.6.6). The plugin's own request validation already runs on zod ^4.6.7, and every array it parses has an upper bound. `@strapi/utils` 5.63.0, a runtime dependency of the plugin, pins zod 4.4.3: the plugin's lockfile now overrides that copy to ^4.6.7, and a regression test fails when any zod 4 below 4.6.6 comes back into the lockfile.
* npm reads `overrides` only in the root project, so a Strapi 5.63 app still installs zod 4.4.3 for its own `@strapi/*` packages until Strapi raises that pin. To patch the app now, add `"overrides": { "zod@4.4.3": "^4.6.7" }` to the app's `package.json`, reinstall and run your tests: zod 4.5 made some string formats stricter.
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