chore!: require Node 22 and clear dev audit advisories #122

Merged
chrnx merged 5 commits from chore/audit-dev-deps into develop 2026-10-10 21:41:44 +00:00
Owner

Clears every npm audit advisory (16 → 0) and, to make the last three fixable, raises the supported Node floor to 22.

Commits 1–3 are dev-dependency bumps only (lockfile, package.json, deno.lock). Commit 4 is a breaking change: @green-tea/core now requires Node 22. Commit 5 moves to vitest 4. The runtime dependency set is untouched: reflect-metadata is still the only one.

Node policy

Maintainer decision: Node 18 and Node 20 are end-of-life and receive no security patches, so @green-tea/core drops them before RC.1. The supported floor is Node 22 (maintenance LTS), and CI runs Node 22 only. Promising a runtime nobody can patch would mean promising something we cannot keep. It also unblocks vitest 4, which needs Node ≥ 20 and clears the last three dev advisories.

Audit

critical high moderate total
npm audit before (develop @ 4d1639f) 3 11 2 16
npm audit after commit 3 2 0 1 3
npm audit after commit 5 (final) 0 0 0 0
npm audit --omit=dev 0 → 0

Commits

  1. chore(deps): apply non-breaking dev-dependency audit fixes: plain npm audit fix, lockfile only. Clears proxy-addr (critical), multer / @nestjs/platform-express, qs, brace-expansion, fast-uri, js-yaml, source-map-js. 16 → 8.
  2. chore(deps): override miniflare's undici and sharp to patched releases: miniflare 4.20260730.0 is still the newest stable and pins undici 7.28.0 / sharp 0.35.2. The existing undici override (7.29.0) now sits inside a new advisory range (≤ 7.29.0), and sharp ≤ 0.35.5-rc.1 has libheif/librsvg advisories. audit fix --force wants miniflare 5.20261006.1-alpha. Instead: override undici → 7.29.1 and add sharp → 0.35.5, both patch releases and the versions that miniflare alpha ships with. test:edge (workerd via miniflare) passes unchanged. 8 → 5.
  3. chore(deps): move the benchmark's fastify to 5.12.5: fastify ≤ 5.12.4 (7 advisories, high), reached directly and through @nestjs/platform-fastify 11.2.7, which pins 5.11.3. audit fix --force wants @nestjs/platform-fastify 12, which is ESM-only and needs @nestjs/core and @nestjs/common 12 as well. Instead: devDependency ^5.11.0 → ^5.12.5, plus "fastify": "$fastify" override so the tree has one patched copy. BENCH_SMOKE=1 npm run bench: fastify, nestjs-fastify and nestjs-express boot and serve every scenario with 0% errors. 5 → 3.
  4. build!: require Node 22 (BREAKING CHANGE: footer): engines.node >=18 → >=22, @types/node ^18.19.0 → ^22.20.5, tsup target node18 → node22, and CI's build job from Node 18 to 22. Every workflow (ci.yml, stage.yml, release.yml; promote.yml sets no Node) now uses Node 22 only, and there is no .gitea/ directory. README, CONTRIBUTING, the bug-report template example (Node 20.11 → 22.12) and the code comments that stated 18 as the floor were updated. A [Unreleased] → Breaking CHANGELOG entry was added. Node <22 code paths:
    • src/http/core.ts: the node:crypto fallback for randomUUID existed only because Node 18 lacked the global crypto. It was removed, along with test/node-floor.test.ts, whose own comment said both could go once the floor moved above 18.
    • src/http/ws-adapter.ts: the ws fallback in loadWebSocketCtor stays. Node 22 has the global WebSocket, but --no-experimental-websocket can still switch it off, and the ws peer is installed for the server side anyway. Only the comment changed.
    • src/app/index.ts: the comment on closeAllConnections() (Node 18.2) was corrected. No code change.
    • engines is plain >=22. Nothing on the npm path needs a minor version. process.getBuiltinModule (22.3+) is used only on the JSR source path, as before. That path already needed 22.3+ under the old floor, and engines does not govern it.
  5. chore(deps): vitest 4: vitest ^3.2.7 → ^4.1.11, the first stable release outside every affected range. vitest 4 drops tinypool entirely, and vite stays on ^6.4.3, which vitest 4 accepts. The one change the bump required: ReturnType<typeof vi.fn> is no longer callable as a plain function in vitest 4's types, so test/listener-boundary.test.ts now types its spies as Mock<(...args: unknown[]) => void>. npm 10.9 still crashes in arborist's #loadPeerSet on this tree, so the lockfile was generated with npm 11.6.2. npm ci with Node 22's bundled npm 10 installs it cleanly. 3 → 0.

What remained after commit 3, and why (resolved by commits 4–5)

All three remaining advisories come from vitest 3.2.7: vitest (critical), tinypool (critical, prototype pollution to RCE in worker options), @vitest/mocker (moderate, path traversal). The first stable release that fixes them is vitest 4.1.11 (audit suggests 5.0.3). Neither fits as a drop-in bump:

  • The CI build job runs npm test on Node 18. I tried vitest 4.1.11 without saving it: 652/652 pass on Node 22, but on Node 18.20.8 it fails at startup with ERR_REQUIRE_ESM. vitest 4 needs Node ≥ 20 and vitest 5 needs ≥ 22.12.
  • vitest 4's optional peer @types/node is ^20 || ^22 || >=24. We pin ^18 to match engines, so npm refuses the install (arborist crashes in #loadPeerSet) unless @types/node is raised too.

Fixing these means choosing where the test runner's Node floor sits: run the build job on Node 20+ while keeping engines >=18, or raise engines. That is a policy decision rather than a dependency bump, so it is left for a separate change. Until then these stayed in the continue-on-error audit step. They affect only the local and CI test runner, and nothing that ships.

Update: the maintainer chose to raise engines to Node 22 (commit 4), which made vitest 4.1.11 possible (commit 5).

Gates (commits 1–3)

lint, format:check, typecheck, typecheck:bench, test (652 passed on Node 22; 651 on Node 18), complexity:check, build, test:deno, test:bun, test:edge: all pass. bench:compare was not run: it compares green-tea against an earlier green-tea, so it never loads the fastify or Nest deps that changed here. The smoke run of npm run bench above is the check that loads them.

One flake seen once after commit 1: test/parity.test.ts (raw-socket status read returned NaN, 11 tests) failed during a full run, then passed in isolation and in 3 consecutive full runs plus every later gate run. It does not look dependency-related.

Gates (commits 4 and 5, on Node 22.22.2)

After each commit: lint, format:check, typecheck, typecheck:bench, test (651 passed; the count drops by one because test/node-floor.test.ts was removed), complexity:check, build, test:deno, test:bun, test:edge, plus deno publish --dry-run: all pass. npm audit: 0. npm audit --omit=dev: 0.

While I was verifying commit 5, the machine running the tests was heavily I/O-loaded (load average 40–160, from unrelated system processes). During that window, full runs failed a varying set of wall-clock tests: close() took 11.9 s against a 600 ms bound, and several tests hit 5 s timeouts. The failing tests changed from run to run. They all passed in isolation and in two consecutive clean full runs once the load dropped, so they look environmental rather than caused by vitest 4.

Dependabot branches on the GitHub mirror

This PR supersedes all seven without merging any of them:

  • fast-uri-3.1.7, js-yaml-4.3.2: covered by commit 1.
  • multi-41e049ac53, multi-c0ce5d8af4, multi-f44c753a73 (Nest 12 majors): replaced by commits 1 and 3, which stay on Nest 11.
  • multi-87a60b44bd (miniflare ^5.20260921.0-alpha): a prerelease. Replaced by commit 2.
  • multi-00f7b83f97 (vitest ^5.0.1): not taken. Commit 5 uses vitest 4.1.11 instead, which clears the same advisories, and vitest 5 would raise the test runner's floor to Node 22.12.
Clears every `npm audit` advisory (16 → 0) and, to make the last three fixable, raises the supported Node floor to 22. Commits 1–3 are dev-dependency bumps only (lockfile, `package.json`, `deno.lock`). Commit 4 is a **breaking** change: `@green-tea/core` now requires Node 22. Commit 5 moves to vitest 4. The runtime dependency set is untouched: `reflect-metadata` is still the only one. ## Node policy Maintainer decision: Node 18 and Node 20 are end-of-life and receive no security patches, so `@green-tea/core` drops them **before RC.1**. The supported floor is Node 22 (maintenance LTS), and CI runs Node 22 only. Promising a runtime nobody can patch would mean promising something we cannot keep. It also unblocks vitest 4, which needs Node ≥ 20 and clears the last three dev advisories. ## Audit | | critical | high | moderate | total | |---|---|---|---|---| | `npm audit` before (develop @ 4d1639f) | 3 | 11 | 2 | 16 | | `npm audit` after commit 3 | 2 | 0 | 1 | 3 | | `npm audit` after commit 5 (final) | 0 | 0 | 0 | **0** | | `npm audit --omit=dev` | 0 → 0 | | | | ## Commits 1. **`chore(deps): apply non-breaking dev-dependency audit fixes`**: plain `npm audit fix`, lockfile only. Clears proxy-addr (critical), multer / @nestjs/platform-express, qs, brace-expansion, fast-uri, js-yaml, source-map-js. 16 → 8. 2. **`chore(deps): override miniflare's undici and sharp to patched releases`**: miniflare 4.20260730.0 is still the newest stable and pins undici 7.28.0 / sharp 0.35.2. The existing `undici` override (7.29.0) now sits inside a new advisory range (≤ 7.29.0), and sharp ≤ 0.35.5-rc.1 has libheif/librsvg advisories. `audit fix --force` wants miniflare 5.20261006.1-alpha. Instead: override `undici` → 7.29.1 and add `sharp` → 0.35.5, both patch releases and the versions that miniflare alpha ships with. `test:edge` (workerd via miniflare) passes unchanged. 8 → 5. 3. **`chore(deps): move the benchmark's fastify to 5.12.5`**: fastify ≤ 5.12.4 (7 advisories, high), reached directly and through @nestjs/platform-fastify 11.2.7, which pins 5.11.3. `audit fix --force` wants @nestjs/platform-fastify 12, which is ESM-only and needs @nestjs/core and @nestjs/common 12 as well. Instead: devDependency `^5.11.0` → `^5.12.5`, plus `"fastify": "$fastify"` override so the tree has one patched copy. `BENCH_SMOKE=1 npm run bench`: fastify, nestjs-fastify and nestjs-express boot and serve every scenario with 0% errors. 5 → 3. 4. **`build!: require Node 22`** (`BREAKING CHANGE:` footer): `engines.node` `>=18` → `>=22`, `@types/node` `^18.19.0` → `^22.20.5`, tsup `target` `node18` → `node22`, and CI's `build` job from Node 18 to 22. Every workflow (`ci.yml`, `stage.yml`, `release.yml`; `promote.yml` sets no Node) now uses Node 22 only, and there is no `.gitea/` directory. README, CONTRIBUTING, the bug-report template example (Node 20.11 → 22.12) and the code comments that stated 18 as the floor were updated. A `[Unreleased] → Breaking` CHANGELOG entry was added. Node <22 code paths: - `src/http/core.ts`: the `node:crypto` fallback for `randomUUID` existed only because Node 18 lacked the global `crypto`. It was **removed**, along with `test/node-floor.test.ts`, whose own comment said both could go once the floor moved above 18. - `src/http/ws-adapter.ts`: the `ws` fallback in `loadWebSocketCtor` **stays**. Node 22 has the global `WebSocket`, but `--no-experimental-websocket` can still switch it off, and the `ws` peer is installed for the server side anyway. Only the comment changed. - `src/app/index.ts`: the comment on `closeAllConnections()` (Node 18.2) was corrected. No code change. - `engines` is plain `>=22`. Nothing on the npm path needs a minor version. `process.getBuiltinModule` (22.3+) is used only on the JSR source path, as before. That path already needed 22.3+ under the old floor, and `engines` does not govern it. 5. **`chore(deps): vitest 4`**: `vitest` `^3.2.7` → `^4.1.11`, the first stable release outside every affected range. vitest 4 drops `tinypool` entirely, and `vite` stays on `^6.4.3`, which vitest 4 accepts. The one change the bump required: `ReturnType<typeof vi.fn>` is no longer callable as a plain function in vitest 4's types, so `test/listener-boundary.test.ts` now types its spies as `Mock<(...args: unknown[]) => void>`. npm 10.9 still crashes in arborist's `#loadPeerSet` on this tree, so the lockfile was generated with npm 11.6.2. `npm ci` with Node 22's bundled npm 10 installs it cleanly. 3 → 0. ## What remained after commit 3, and why (resolved by commits 4–5) All three remaining advisories come from **vitest 3.2.7**: vitest (critical), tinypool (critical, prototype pollution to RCE in worker options), @vitest/mocker (moderate, path traversal). The first stable release that fixes them is **vitest 4.1.11** (audit suggests 5.0.3). Neither fits as a drop-in bump: - The CI `build` job runs `npm test` on **Node 18**. I tried vitest 4.1.11 without saving it: 652/652 pass on Node 22, but on Node 18.20.8 it fails at startup with `ERR_REQUIRE_ESM`. vitest 4 needs Node ≥ 20 and vitest 5 needs ≥ 22.12. - vitest 4's optional peer `@types/node` is `^20 || ^22 || >=24`. We pin `^18` to match `engines`, so npm refuses the install (arborist crashes in `#loadPeerSet`) unless `@types/node` is raised too. Fixing these means choosing where the test runner's Node floor sits: run the `build` job on Node 20+ while keeping `engines >=18`, or raise `engines`. That is a policy decision rather than a dependency bump, so it is left for a separate change. Until then these stayed in the `continue-on-error` audit step. They affect only the local and CI test runner, and nothing that ships. **Update:** the maintainer chose to raise `engines` to Node 22 (commit 4), which made vitest 4.1.11 possible (commit 5). ## Gates (commits 1–3) `lint`, `format:check`, `typecheck`, `typecheck:bench`, `test` (652 passed on Node 22; 651 on Node 18), `complexity:check`, `build`, `test:deno`, `test:bun`, `test:edge`: all pass. `bench:compare` was not run: it compares green-tea against an earlier green-tea, so it never loads the fastify or Nest deps that changed here. The smoke run of `npm run bench` above is the check that loads them. One flake seen once after commit 1: `test/parity.test.ts` (raw-socket status read returned NaN, 11 tests) failed during a full run, then passed in isolation and in 3 consecutive full runs plus every later gate run. It does not look dependency-related. ## Gates (commits 4 and 5, on Node 22.22.2) After each commit: `lint`, `format:check`, `typecheck`, `typecheck:bench`, `test` (651 passed; the count drops by one because `test/node-floor.test.ts` was removed), `complexity:check`, `build`, `test:deno`, `test:bun`, `test:edge`, plus `deno publish --dry-run`: all pass. `npm audit`: 0. `npm audit --omit=dev`: 0. While I was verifying commit 5, the machine running the tests was heavily I/O-loaded (load average 40–160, from unrelated system processes). During that window, full runs failed a varying set of wall-clock tests: `close()` took 11.9 s against a 600 ms bound, and several tests hit 5 s timeouts. The failing tests changed from run to run. They all passed in isolation and in two consecutive clean full runs once the load dropped, so they look environmental rather than caused by vitest 4. ## Dependabot branches on the GitHub mirror This PR supersedes all seven without merging any of them: - `fast-uri-3.1.7`, `js-yaml-4.3.2`: covered by commit 1. - `multi-41e049ac53`, `multi-c0ce5d8af4`, `multi-f44c753a73` (Nest 12 majors): replaced by commits 1 and 3, which stay on Nest 11. - `multi-87a60b44bd` (miniflare `^5.20260921.0-alpha`): a prerelease. Replaced by commit 2. - `multi-00f7b83f97` (vitest `^5.0.1`): not taken. Commit 5 uses vitest 4.1.11 instead, which clears the same advisories, and vitest 5 would raise the test runner's floor to Node 22.12.
chrnx added 3 commits 2026-10-10 17:02:21 +00:00
`npm audit fix` without --force: every bump stays inside the ranges
package.json already declares, so only the lockfile changes.

Clears proxy-addr (critical), multer and @nestjs/platform-express,
qs, brace-expansion, fast-uri, js-yaml and source-map-js. All of them
are dev or benchmark dependencies; `npm audit --omit=dev` was and
stays at 0.

npm audit: 16 (3 critical, 11 high, 2 moderate) -> 8 (2 critical,
4 high, 2 moderate).

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
miniflare 4.20260730.0 is still the newest stable release, and it pins
undici 7.28.0 and sharp 0.35.2. The existing undici 7.29.0 override is
now inside a new advisory range (7.0.0 - 7.29.0, high), and sharp is
under two libheif/librsvg advisories (<= 0.35.5-rc.1, high).
`npm audit fix --force` would install miniflare 5.20261006.1-alpha:
a major and a prerelease, for a test-only dependency.

Move the undici override to 7.29.1 and add sharp 0.35.5, both patch
releases and the exact versions the next miniflare ships with. Same
approach already used for find-my-way, hyperid's uuid and undici.

`test:edge` is the suite that drives workerd through miniflare and it
passes unchanged.

npm audit: 8 (2 critical, 4 high, 2 moderate) -> 5 (2 critical,
1 high, 2 moderate). `npm audit --omit=dev` stays at 0.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
chore(deps): move the benchmark's fastify to 5.12.5
CI / dco (pull_request) Successful in 5s
CI / runtimes (bun) (pull_request) Successful in 14s
CI / build (pull_request) Successful in 29s
CI / runtimes (deno) (pull_request) Successful in 19s
CI / runtimes (edge) (pull_request) Successful in 13s
4c3b4d29c4
fastify <= 5.12.4 carries seven advisories (high), and it reaches us
twice, both benchmark-only: as a direct devDependency and through
@nestjs/platform-fastify 11.2.7, which pins fastify 5.11.3 exactly.
`npm audit fix --force` would move to @nestjs/platform-fastify 12,
which is ESM-only and needs @nestjs/core and @nestjs/common 12 as
well: a migration of the Nest benchmark servers, not a dependency fix.

Raise the direct range to ^5.12.5, a patch inside the major we already
use, and point nest's copy at it with `"fastify": "$fastify"` so the
tree holds a single, patched fastify.

Checked with `BENCH_SMOKE=1 npm run bench`: fastify, nestjs-fastify
and nestjs-express all boot and serve every scenario with 0% errors.

npm audit: 5 (2 critical, 1 high, 2 moderate) -> 3 (2 critical,
1 moderate), all of them vitest. `npm audit --omit=dev` stays at 0.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
chrnx added 2 commits 2026-10-10 20:13:37 +00:00
Node 18 and Node 20 are end-of-life and receive no security patches, so
supporting them before RC.1 would mean promising a runtime nobody can
patch. Node 22 is the oldest line still maintained.

engines.node moves to >=22, @types/node to ^22, the tsup target to
node22, and CI's build job from Node 18 to 22, so every workflow now
runs Node 22 only. The docs, the bug report example and the comments
that stated 18 as the floor follow.

The node:crypto fallback in the HTTP core existed only for Node 18,
which lacked the global crypto; it goes with its regression test, which
said as much. The ws fallback for the WebSocket client stays: Node 22
has the global, but it can still be switched off with a flag.

Moving off Node 18 and 20 also unblocks vitest 4, which the remaining
dev audit advisories need.

BREAKING CHANGE: Node 18 and Node 20 are no longer supported. The
minimum is Node 22.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
chore(deps): vitest 4
CI / runtimes (bun) (pull_request) Successful in 15s
CI / runtimes (deno) (pull_request) Successful in 19s
CI / dco (pull_request) Successful in 4s
CI / build (pull_request) Successful in 26s
CI / runtimes (edge) (pull_request) Successful in 13s
77a99e83ce
vitest 3.2.7 carried the last three dev audit advisories: tinypool
(critical, prototype pollution to RCE in worker options), vitest itself
(critical, through tinypool and @vitest/mocker) and @vitest/mocker
(moderate, path traversal through a redirected mock). 4.1.11 is the
first stable release outside every affected range; vitest 4 no longer
depends on tinypool at all. It needs Node 20 or newer, which the Node 22
floor now guarantees. vitest 5 would need Node 22.12, and 4.1.11 is
enough to clear the advisories.

vite stays on ^6.4.3, which vitest 4 accepts.

The one change the bump requires: vitest 4 types `vi.fn()` with no
arguments as a mock of a function *or* a constructor, so
`ReturnType<typeof vi.fn>` is no longer callable as a plain function.
listener-boundary.test.ts now types its spies as
`Mock<(...args: unknown[]) => void>`.

npm 10.9 crashes in arborist's #loadPeerSet resolving this tree, so the
lockfile was produced with npm 11.6.2; `npm ci` on Node 22's bundled
npm 10 installs it cleanly.

npm audit: 3 -> 0. npm audit --omit=dev stays at 0.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
chrnx changed title from chore(deps): clear dev-dependency audit advisories (16 -> 3) to chore!: require Node 22 and clear dev audit advisories 2026-10-10 21:13:18 +00:00
chrnx merged commit ed47836c98 into develop 2026-10-10 21:41:44 +00:00
Sign in to join this conversation.