Skip to content

Move to Node 24 and clear critical npm audit findings - #28

Merged
Herm71 merged 4 commits into
mainfrom
26-27-node-and-npm-audit
Oct 7, 2026
Merged

Herm71 merged 4 commits into
mainfrom
26-27-node-and-npm-audit

Conversation

@Herm71

@Herm71 Herm71 commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Moves CI and releases to Node 24 (#27) and clears npm audit's critical findings in the dev toolchain (#26). Nothing in the release zip changes.

Closes #26
Closes #27

What changed

Node 24 (#27)

  • .nvmrc: pins 24, the current LTS. ci.yml (two jobs) and release.yml read it with node-version-file: .nvmrc, replacing three hard-coded node-version: 20 lines.
  • Actions: moved to the majors that run on Node 24: actions/checkout v7, actions/setup-node v7, actions/cache v6 and softprops/action-gh-release v3. shivammathur/setup-php@v2 already runs on Node 24. Each one's action.yml was checked. action-gh-release v3's only change is the runtime.

npm audit (#26): 96 → 37 findings, 0 critical

Step Findings
Before 96 (2 critical, 35 high)
npm audit fix, no --force (lockfile only) 85 (0 critical)
@wordpress/scripts ^34 → ^36.1.0, lockfile regenerated from a clean resolve 38
lint-staged ^15 → ^17.6.0 37 (0 critical, 20 high)
  • prettier is now npm:wp-prettier@^3.9.6. wp-scripts 36's format refuses to run unless node_modules/prettier is the WordPress fork. The plain prettier@^3.1.1 from the first commit took that spot once the lockfile was regenerated. Removing it wasn't enough, because @wordpress/prettier-config and the ESLint plugin peer-depend on prettier. The alias satisfies both, as WordPress's docs recommend. The pre-commit hook caught this.
  • engines.node copies @wordpress/scripts 36's requirement (^22.22.2 || ^24.15.0 || >=26.0.0), so an old local Node warns instead of failing obscurely.
  • Docs: CLAUDE.md, README and ROADMAP (new §7, v1.3.0).

Why

Left as-is, on purpose. The 20 remaining high findings are all inside @wordpress/scripts 36.1.0, the latest release:

  • braces <=3.0.3 (GHSA-vfj7-8cjw-p6xm) has no patched release; 3.0.3 is the latest. micromatch, fast-glob, globby, chokidar, stylelint and npm-package-json-lint are flagged only for depending on it.
  • serialize-javascript <7.0.5 is pinned at 6.x by copy-webpack-plugin / the terser plugin. An overrides entry would force a major version into webpack's minifier. This plugin never runs webpack (there's no src/), so CI couldn't catch it if that broke.

None of these are reachable from what this plugin runs: format, lint-pkg-json and plugin-zip.

How to test

nvm use                 # 24
npm ci && composer install
npm test                # 27 node + 57 PHPUnit
npm run lint:pkg-json
npm run format && git diff --exit-code   # no drift
npm audit               # 37: 0 critical, 20 high

Release zip: composer install --no-dev && npm run zip && unzip -Z1 jc-core-functionality.zip. It has the same 148 entries as before the upgrade, including the single jc-core-functionality/ root folder, vendor/, acf-json/ and LICENSE. Restore dev dependencies with composer install.

CI: this PR is the first run on Node 24 and the new action majors. All three jobs should pass with no Node.js deprecation warning.

Release workflow: not exercised by this PR. Before relying on it for a real release, push a vX.Y.Z-rc.N tag. It should publish a Pre-release with jc-core-functionality.zip attached, which confirms action-gh-release v3 and the .nvmrc read.

Breaking changes

  • Local development needs Node 22.22.2+ or 24.15.0+. npm install warns on older versions, and nvm use picks up .nvmrc.
  • prettier resolves to wp-prettier. That's the formatter WordPress's own tooling expects, and it changes no files in this repo.

Migration steps

  • Run nvm use (or install Node 24), then npm ci.

🤖 Generated with Claude Code

Herm71 and others added 4 commits October 7, 2026 11:38
Node 20 reached end of life in April 2026, and GitHub warned on every
run that checkout, setup-node and cache v4 target it. It already cost a
CI failure in #25: node --test globs need Node 21+.

.nvmrc pins 24 (the current LTS, and what @wordpress/scripts 36 needs
for #26). All three Node jobs read it through node-version-file, so
local development and CI cannot drift apart again.

Actions move to the majors that run on Node 24: checkout v7,
setup-node v7, cache v6, action-gh-release v3 (its v3 only changes the
runtime). setup-php@v2 already does.

Refs #27

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
npm audit fix (without --force) updates transitive dev dependencies
within their existing ranges. It clears both critical advisories
(proxy-addr, websocket-driver, from the webpack dev-server tree) and
takes the total from 96 to 85. Lockfile only; no direct dependency
changes.

Refs #26

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@wordpress/scripts 36.1.0 is what npm audit recommended for the high
findings in its tree. Installing it over the existing lockfile failed
on an optional-peer conflict deep in its vitest/vite tree, so the
lockfile is regenerated from a clean resolve. lint-staged 17 drops the
micromatch/braces chain from our own direct dependency.

prettier is now aliased to wp-prettier. The plain "prettier": "^3.1.1"
from the first commit sat at node_modules/prettier, and wp-scripts 36's
format refuses to run unless that resolves to the WordPress fork. The
old lockfile happened to hoist the fork; a clean resolve did not, and
the pre-commit hook caught it. Removing the dependency was not enough:
@wordpress/prettier-config and the ESLint plugin peer-depend on
prettier, so npm installs the plain one anyway. The alias satisfies
both, as the WordPress docs recommend.

npm audit: 85 -> 37 (0 critical, 20 high, 14 moderate, 3 low). The
remaining high findings are all inside @wordpress/scripts 36.1.0, the
latest release, and none are reachable from what this plugin runs
(format, lint-pkg-json, plugin-zip):
- braces <=3.0.3 (GHSA-vfj7-8cjw-p6xm) has no patched release; 3.0.3
  is the latest. micromatch, fast-glob, globby, chokidar, stylelint and
  npm-package-json-lint are flagged only for depending on it.
- serialize-javascript <7.0.5 is pinned at 6.x by the webpack plugins.
  An override would force a major version into webpack's minifier,
  which this plugin never runs and CI could not exercise.

engines.node mirrors @wordpress/scripts 36's requirement, so an old
local Node warns instead of failing obscurely; .nvmrc (24) satisfies it.

Verified by exit code: npm test, lint:pkg-json, wp-scripts format with
no drift, and the release zip has the same 148 entries as before.

Refs #26

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
CLAUDE.md now says to use Node 24 from .nvmrc, why prettier must stay
aliased to wp-prettier, and why the remaining npm audit findings are
not worth chasing with overrides. README adds nvm use to the setup
steps. ROADMAP gains the v1.3.0 milestone and ticks #26 and #27.

Refs #26, #27

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Herm71 Herm71 added this to the v1.3.0 — Maintenance milestone Oct 7, 2026
@Herm71 Herm71 added security Security hardening tooling Build, lint, CI, release tooling labels Oct 7, 2026
@Herm71
Herm71 merged commit 35dcc85 into main Oct 7, 2026
3 checks passed
@Herm71
Herm71 deleted the 26-27-node-and-npm-audit branch October 7, 2026 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security Security hardening tooling Build, lint, CI, release tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move CI and release workflows off deprecated Node.js 20 Clear npm audit findings in dev dependencies (@wordpress/scripts tree)

1 participant