Skip to content

fix(deps): Patch 87 security advisories and move to wp-env 12 and wp-scripts 37 on Node 22 - #603

Open
rtio wants to merge 9 commits into
trunkfrom
fix/dependabot-security-20261117
Open

rtio wants to merge 9 commits into
trunkfrom
fix/dependabot-security-20261117

Conversation

@rtio

@rtio rtio commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

All Submissions:

  • Does your code follow the WooCommerce Sniffs variant of WordPress coding standards?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?
  • Will this change require new documentation or changes to existing documentation?

Changes proposed in this Pull Request:

This PR closes all 87 open critical and high Dependabot alerts, including all 5 critical ones. Every change is in dev tooling and build config.

The simple-git alerts need @wordpress/env 12, and wp-env 12 needs Node 22.13 or later. So this PR moves .nvmrc to 22.23.5 and engines.node to >=22.13.0. Every workflow reads .nvmrc, so CI moves too.

@wordpress/scripts goes from 24 to 37.2.0. That release brings patched adm-zip, markdownlint-cli (minimatch, markdown-it, linkify-it) and webpack-dev-server 6 on its own, and drops puppeteer-core 13 with its unpatched extract-zip. The overrides that patched those inside the old tree are gone. The upgrade needs four follow-ups:

  • @wordpress/data 7 peers on React 17 and wp-scripts 37 peers on React 18 or 19, so @wordpress/data moves to ^10.27.0. The build externalizes it to wp-data, so nothing ships from it.
  • ESLint 10 no longer reads .eslintrc.js. The config moves to eslint.config.mjs on @woocommerce/eslint-plugin 4.1, with the same rules, globals and ignores.
  • The webpack config maps react/jsx-runtime to WordPress' react-jsx-runtime script instead of bundling it. Without that, the bundles would carry React 19's runtime, which WordPress' React 18 cannot render.
  • The E2E helpers import node-fetch without declaring it. wp-scripts 24 used to hoist it, so it is now a devDependency.

copy-webpack-plugin moves to 14, which depends on the patched serialize-javascript 7.

Package From To Alerts
@wordpress/env (simple-git) 10.27.0 (3.28.0) 12.2.0 (4.1.0) 6
@wordpress/scripts (adm-zip, extract-zip, markdown-it, linkify-it, minimatch, webpack-dev-middleware) 24.6.0 37.2.0 11
axios 1.11.0, 0.30.0 1.21.1, 0.x removed 18
node-forge 1.3.1 removed (selfsigned 5 no longer uses it) 9
fast-uri 3.0.6 3.1.9 8
js-yaml 3.14.1, 4.1.0 3.15.2, 4.3.2 6
immutable 5.1.3 5.2.1 3
svgo 2.8.0 2.8.4 3
brace-expansion 1.1.12, 2.0.2 1.1.22, 2.1.8 2
glob 10.4.5, 11.0.3 10.5.0, 11.1.0 2
postcss 8.5.6 8.5.33 2
shell-quote 1.8.3 1.12.0 2
copy-webpack-plugin (serialize-javascript) 13.0.0 14.0.0 1
lodash, proxy-addr, websocket-driver 4.17.21, 2.0.7, 0.7.4 4.18.1, 2.0.8, 0.7.5 3
@babel/plugin-transform-modules-systemjs, browserslist, compression, flatted, form-data, launch-editor, nanoid, source-map-js, tar-fs, tmp, ws patched releases 11

Overrides: removed adm-zip and axios under @wordpress/scripts, minimatch under markdownlint-cli, and the old webpack-dev-server ^5.2.1 (wp-scripts 37 requires ^6). Kept: isomorphic-git ~1.38.10 under @wp-playground/storage (3.1.66 still pins 1.37.6), and serialize-javascript ^7.0.3, because wp-scripts 37 still ships copy-webpack-plugin 10 and terser-webpack-plugin 5.3.

Left open: none of the critical or high alerts. 9 moderate and low alerts stay (minimatch 9/10, qs, postcss-selector-parser, @babel/core, uuid, picomatch).

Lint: the new config reports problems that ESLint 8 with @woocommerce/eslint-plugin 2.3 did not. npm run lint:js on src/ goes from 0 to 11 errors and 43 warnings: prettier/prettier 6, @typescript-eslint/no-unused-vars 3, import/order 1, one inline disable of the removed @woocommerce/dependency-group rule, 27 import/no-unresolved warnings for externalized @wordpress/* packages, and 16 unused eslint-disable warnings. This PR does not touch src/. The ESLint workflow only lints changed .js files, and it passes.

Contributors need Node 22.13 or later (wp-scripts 37: 22.22.2 or later). Some @woocommerce/* and @php-wasm/* dev packages print EBADENGINE warnings. They are only warnings: the repo has no engine-strict.

Steps to test the changes in this Pull Request:

Tested against trunk with the same steps on both sides. trunk used Node 20 with wp-env 10. This branch used Node 22.23.5 with wp-env 12.

Check trunk This PR
npm ci OK OK
npm audit critical / high 4 / 38 0 / 2
Dependabot critical + high alerts 87 open 0 open
npm run build release zip 2,560 files 2,573 files: 13 new *-rtl.css files. 9 JS and CSS bundles and all 16 .asset.php files differ (webpack 5.113, terser and cssnano output). Bundles now list react-jsx-runtime instead of react where they use JSX. No React 19 code in any bundle
npm run lint:js 0 problems 11 errors, 43 warnings (see above)
wp-env start + postenv:start OK OK, with wp-env 12 deprecation warnings for the tests environment
Tests site: home, shop, product, cart, checkout, classic checkout, My account, Square settings, onboarding, products 200 Same. Onboarding and settings render with WordPress' react-jsx-runtime. No console errors, no debug.log lines
PHPUnit in tests-wordpress (PHP 8.3) 146 tests, 1 skipped, OK 146 tests, 1 skipped, OK
E2E (CI, all four suites) Not run locally (needs Square sandbox credentials) Pass

The 2 remaining npm audit highs are path-to-regexp and picomatch, which have no high or critical Dependabot alert here.

Screenshots

Each image is trunk | this PR | pixel diff: onboarding, the Square and Credit Card settings pages, block checkout at 1440 and 390, and a product page at 390. Square ran in sandbox mode with placeholder credentials, so Square's payment SDK leaves the card fields and wallet buttons empty on both sides. All six pairs have 0 differing pixels, with the same console output on both sides and an empty debug.log. None of the new *-rtl.css files is enqueued, because the plugin registers its styles without RTL data, so no RTL screen is shown.

onboarding settings-square settings-credit-card checkout-block-1440 checkout-block-390 product-390

Changelog entry

Dev - Update @wordpress/env to 12.2.0 and @wordpress/scripts to 37.2.0, require Node 22, and update dev dependencies to patched versions.

Closes #604

Bump transitive dependencies within their existing ranges:
- lodash 4.17.21 -> 4.18.1 (GHSA-r5fr-rjxr-66jc, high), via @wordpress/data
- proxy-addr 2.0.7 -> 2.0.8 (GHSA-jqcg-44mw-7w3h, critical), via express
- shell-quote 1.8.3 -> 1.12.0 (GHSA-w7jw-789q-3m8p, critical), via launch-editor
- websocket-driver 0.7.4 -> 0.7.5 (GHSA-xv26-6w52-cph6, critical), via sockjs

None of them end up in the built plugin: lodash is only reached through
@wordpress/data, which the build externalises. Lockfile-only change.
@github-actions

Copy link
Copy Markdown

This is linked to GitHub issue #604.

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Test the build

WordPress Playground - runs in your browser

ℹ️ Neither can connect to Square: signing in to Square has to send you back to the site, and a site that runs in your browser tab has no public address to come back to. Without a connection the store cannot take payments, sync products or receive webhooks, so the previews show what a merchant sees before connecting. Do not enter Square access tokens or other credentials in a preview. The links stop working 14 days after the last build.


Build info:

  • Latest commit: 7666bc6
  • Build time: 2026-11-24 12:59:41 UTC

Note: the build is updated when a new commit is pushed to this PR.

@github-actions

Copy link
Copy Markdown

✅ WordPress Plugin Check Report

✅ Status: Passed

📊 Report

All checks passed! No errors or warnings found.


🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

@rtio
rtio marked this pull request as ready for review November 17, 2026 19:27
rtio added 2 commits November 23, 2026 19:06
@wordpress/env 10 pins simple-git 3.x, and every simple-git 3.x release
is affected by GHSA-r275-fr43-pm7q and GHSA-x6jw-m9v5-85vh (critical).
simple-git 4 is not callable the way wp-env 10 requires it, so the only
fix is the wp-env major. wp-env 12 also drops extract-zip 1.x and the
old tmp from its own tree.

wp-env 12 requires Node >= 22.13, so move .nvmrc to 22.23.5 and
engines.node to >=22.13.0. Every workflow reads the Node version from
.nvmrc, so CI follows.

wp-env 12 pulls isomorphic-git 1.37.6 through @wp-playground/storage;
a scoped override holds it at ~1.38.10, the patched line.

Side effects in the lockfile: express 4.22.2, body-parser 1.20.9 and
qs 6.16.2 move up because @wp-playground/cli requires them, and
js-yaml 3.14.1 -> 3.15.2.

The built plugin zip is byte-identical to trunk built with Node 20,
apart from the .pot creation date and the commit hash in
vendor/composer/installed.php.

Refs #604
Dependabot still reported critical and high advisories in dev
dependencies after the wp-env upgrade. Move each one to a patched
release:

- In-range lockfile bumps: axios 1.11.0 -> 1.21.1, node-forge 1.3.1 ->
  1.4.4, fast-uri 3.0.6 -> 3.1.9, js-yaml 4.1.0 -> 4.3.2, svgo 2.8.0 ->
  2.8.4, immutable 5.1.3 -> 5.2.1, glob 10.5.0 / 11.1.0, minimatch
  3.1.5 / 9.0.9 / 10.2.6, brace-expansion 1.1.22 / 2.1.8, tar-fs 2.1.6,
  ws 8.23.0, tmp 0.2.7 (external-editor is replaced by
  @inquirer/external-editor), browserslist 4.29.6,
  @babel/plugin-transform-modules-systemjs 7.29.15, compression 1.8.2,
  flatted 3.4.4, form-data 4.0.6, launch-editor 2.14.2, nanoid 3.3.20,
  source-map-js 1.2.4, webpack-dev-middleware 7.4.6.
- postcss 8.5.6 -> 8.5.23. Held below 8.5.24, which starts writing a
  UTF-8 BOM into built CSS.
- Overrides: axios for wait-on under @wordpress/scripts moves from
  ^0.30.0 to ^0.34.0; adm-zip ^0.6.1 under @wordpress/scripts;
  minimatch ^3.1.3 under markdownlint-cli; serialize-javascript ^7.0.3,
  used by copy-webpack-plugin and terser-webpack-plugin.

Left open: extract-zip (no patched release, comes in through
puppeteer-core 13), and linkify-it / markdown-it, which markdownlint-cli
pins to markdown-it 12. Both need a @wordpress/scripts major.

The build/ output is byte-identical to trunk built with Node 20.

Refs #604
@rtio rtio changed the title fix(deps): Patch 4 security advisories fix(deps): Patch 83 security advisories and move to wp-env 12 on Node 22 Nov 24, 2026
rtio added 6 commits November 24, 2026 09:39
The Woo dependency extraction plugin (3.x) builds on
@wordpress/dependency-extraction-webpack-plugin 3.7, which predates the
react-jsx-runtime script handle. Any module compiled with the automatic
JSX runtime therefore gets react/jsx-runtime bundled from whatever React
sits in node_modules. Today that already happens for onboarding.js and
settings.js through the @wordpress/icons and @wordpress/components code
they import.

That works only while the bundled runtime matches the React that
WordPress loads. Once @wordpress/scripts compiles our own JSX with the
automatic runtime and node_modules hoists React 19, the bundles create
React 19 elements that WordPress' React 18 refuses to render.

Map react/jsx-runtime to the ReactJSXRuntime global and the
react-jsx-runtime handle, the same mapping newer
@wordpress/dependency-extraction-webpack-plugin releases ship by
default. WordPress registers that script since 6.6; the plugin requires
6.9.

Refs #604
The security overrides on this branch force patched versions of
adm-zip, axios (wait-on) and minimatch (markdownlint-cli) under
@wordpress/scripts 24. Newer @wordpress/scripts releases carry those
fixes themselves: 34 drops jest-dev-server, wait-on and axios 0.x, 35
moves to adm-zip ^0.6.1 and @wordpress/e2e-test-utils-playwright 2 (no
proxy-agent, get-uri or basic-ftp), 36 moves to markdownlint-cli 0.49.
37 also brings webpack-dev-server 6 and drops puppeteer-core 13 with its
extract-zip, which had no patched release.

@wordpress/scripts 34+ declares a peer on React 18 or 19, and the
runtime dependency @wordpress/data 7 peers on React 17, so npm cannot
resolve both. Move @wordpress/data to ^10.27.0, the line that matches
the @wordpress/icons and @wordpress/i18n versions already in use. The
build externalizes @wordpress/data to the wp-data script, so the bump
does not change what ships.

Node 22.23.5 from .nvmrc already satisfies the new engines range
(^22.22.2).

Refs #604
@wordpress/scripts 37 runs ESLint 10, which no longer reads .eslintrc.js
or .eslintignore. Without a flat config, lint-js falls back to the
wp-scripts defaults and ignores the project rules.

Move the project config to eslint.config.mjs, built on
@woocommerce/eslint-plugin 4.1 (the first release with flat configs and
ESLint 10 support). The globals, settings, rule overrides and ignore
list carry over. The ignore patterns keep their gitignore meaning (any
directory named js, build, ...), so lint still covers the same 74 files
in src/.

The webpack config keeps CommonJS; the old config allowed require() in
.js files through @typescript-eslint/no-var-requires, which
typescript-eslint 8 renamed to no-require-imports.

Swap the config file names in .gitattributes and the Plugin Check
exclude list.

Refs #604
@wordpress/scripts 37 brings patched versions on its own:

- adm-zip ^0.6.1 directly.
- axios: wait-on and jest-dev-server are gone; nothing under
  @wordpress/scripts requires axios 0.x any more.
- markdownlint-cli 0.49 resolves minimatch 10.2.6, markdown-it 14.3.3
  and linkify-it 5.0.2 instead of minimatch 3, markdown-it 12 and
  linkify-it 3.

Also drop the webpack-dev-server ^5.2.1 override. @wordpress/scripts 37
requires webpack-dev-server ^6, and the override was holding it at
5.2.2. Version 6.1.0 also moves selfsigned to 5, which no longer
depends on node-forge.

Kept: isomorphic-git (@wp-playground/storage 3.1.66 still pins 1.37.6)
and serialize-javascript (@wordpress/scripts 37 still ships
copy-webpack-plugin 10 and terser-webpack-plugin 5.3, which require
serialize-javascript ^6).

Refs #604
copy-webpack-plugin 14 depends on serialize-javascript ^7.0.3, the
patched line, so the direct dependency no longer relies on the
serialize-javascript override. The override stays for the
copy-webpack-plugin 10 and terser-webpack-plugin 5.3 that
@wordpress/scripts 37 still ships.

Version 14 requires Node >= 20.9, which .nvmrc already exceeds. The
copied images in build/images are unchanged.

Refs #604
Three E2E helpers import node-fetch, but package.json never listed it.
It resolved only because @wordpress/scripts 24 hoisted node-fetch 2.6.7
into node_modules. @wordpress/scripts 37 no longer brings it, so every
E2E suite failed with "Cannot find module 'node-fetch'".

Declare node-fetch ^2.7.0. Version 2 keeps the CommonJS default export
the helpers import; version 3 is ESM only.

Refs #604
@rtio rtio changed the title fix(deps): Patch 83 security advisories and move to wp-env 12 on Node 22 fix(deps): Patch 87 security advisories and move to wp-env 12 and wp-scripts 37 on Node 22 Nov 24, 2026
@rtio

rtio commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Re-ran this against today's trunk (47d618e) with the PR head at 7666bc6. trunk hasn't moved since the last update, so there's nothing to merge. Same commands on both sides: trunk on Node 20.19.2 with wp-env 10, this PR on Node 22.23.5 with wp-env 12.

Check Base PR
npm ci OK OK
npm audit critical / high 4 / 38 0 / 2
Open critical + high Dependabot alerts 87 0 (all 87 resolve to patched versions in this lockfile)
npm run build release zip 2,560 files 2,573 files: 13 new *-rtl.css; the same 9 bundles and 16 .asset.php files differ
npm run lint:js 0 problems 11 errors, 43 warnings
wp-env start + postenv:start OK OK
Tests site: home, shop, product, cart, checkout, classic checkout, My account, Square settings, onboarding, products 200; checkout redirects to the empty cart. No debug.log lines Same
PHPUnit in tests-wordpress 146 tests, 1 skipped, OK 146 tests, 1 skipped, OK

The JS and CSS bundles are byte-identical to the build behind the screenshots in the description, so those still apply. The lint increase is the one the description already explains.

Same results as the description.

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.

Tracking Issue for PR #603: fix(deps): Patch 4 security advisories

1 participant