Skip to content

chore(deps): upgrade @wordpress/scripts to 33 and refresh the lockfile - #235

Merged
erseco merged 2 commits into
mainfrom
chore/npm-security-overrides
Jul 28, 2026
Merged

chore(deps): upgrade @wordpress/scripts to 33 and refresh the lockfile#235
erseco merged 2 commits into
mainfrom
chore/npm-security-overrides

Conversation

@erseco

@erseco erseco commented Jul 28, 2026

Copy link
Copy Markdown
Member

Reduces the open Dependabot alerts by lifting an obsolete version cap and refreshing a stale lockfile. No overrides.

Every open alert is npm, in package-lock.json, and transitive through @wordpress/scripts. None are Composer — the ranges pinned in #232 are not involved.

The version cap was obsolete

.github/dependabot.yml held @wordpress/scripts below 32.3.0 and @wordpress/e2e-test-utils-playwright below 1.47.0, because those releases pointed their package exports at TypeScript source the Playwright runner cannot load. Upstream reverted it:

1.46.0  exports["."].default = ./build/index.cjs
1.47.0  exports["."].default = ./src/index.ts     <- the breakage
1.48.0  exports["."].default = ./src/index.ts
1.50.0  exports["."].default = ./build/index.js   <- fixed
1.51.0  exports["."].default = ./build/index.js

So the cap is removed and both packages track latest again, confirmed by running the E2E suite on the uncapped toolchain — the job the cap existed to protect.

Result

Configuration Distinct advisories
main, untouched 34
Upgrade alone 33
Upgrade + npm update (this PR) 17
Upgrade + 18 forced overrides 6

Half the advisories go away with no unusual machinery: the lockfile had simply gone stale, and npm update moves the tree to patched releases the parents' own ranges already allow.

An earlier revision of this branch took the last route, forcing 18 versions through overrides. It was dropped. The extra eleven advisories can only be bought by crossing majors upstream never tested together — webpack-dev-server 4→5, uuid 8→11, serialize-javascript 6→7, markdown-it 12→14, linkify-it 3→5, adm-zip 0.5→0.6 — inside chains this project never executes. There is no build step and no dev server in package.json, so webpack, postcss and svgo are installed but never run. Those alerts will clear as @wordpress/scripts moves, with no forced pins left behind to maintain.

npm audit fix was not an option either: every remaining fix needs --force, which would have lifted the cap blindly rather than after checking upstream had fixed the entry point.

Two numbers that look wrong and are not

npm audit's total rises from 43 to 64 while distinct advisories halve. It counts packages affected, not advisories, and the one unfixable advisory below cascades widely through the changed tree.

brace-expansion cannot be fixed. Only 5.0.8+ is patched, but v5's CommonJS entry exports { expand } instead of the callable default v1/v2 exported. minimatch@3 and @9 call expand(pattern), so forcing it throws expand is not a function and takes glob, jest and eslint with it. Verified by running it, not assumed. It needs upstream minimatch to migrate.

Verification

Rebased onto main after #236 merged, and re-verified there.

npm ci                 ✓ exits 0, and now leaves a clean tree (#236)
npm run test:unit-js   ✓ 9 tests
make test              ✓ 1808 tests, 13086 assertions
make test-e2e          ✓ 72 passed, 1 pre-existing failure, 21 skipped

The E2E failure is document-types.spec.js:17. It is not a regression: a full run on main with no changes applied fails the same test with the same 72/1/21 counts. Root cause found while investigating — DocumentTypesPage.create() registers waitForResponse after clicking submit, so a fast response arrives before the listener exists. Left for a separate fix rather than folded in here.

What still shows up

The 17 remaining advisories, all transitive and all needing a major crossing this PR declines to force:

Package Advisories Arrives via Reachable here?
webpack-dev-server 5 @wordpress/scripts No — dev server for a start script that does not exist
minimatch 3 eslint plugins, rimrafglob, lighthouse Globbing only
serialize-javascript 2 copy-webpack-plugin No — there is no build step
linkify-it 2 markdown-itmarkdownlint No — docs linting is not run
brace-expansion 1 under minimatch See above; unfixable
adm-zip 1 @wordpress/env Yes — unpacking WordPress from wordpress.org
markdown-it, uuid, @opentelemetry/core 3 markdownlint, sockjs, @sentry/node No

adm-zip is the only one in a chain CI actually executes, and the advisory is a crafted ZIP triggering a large allocation — the ZIP being WordPress itself, fetched from wordpress.org.

path-to-regexp and body-parser, present before, were resolved by the upgrade.

Not included

  • @playwright/test is used but not declaredrequire()d in tests/e2e/playwright.config.js, resolving by hoisting. Declaring it would be more honest, but Playwright breaks badly when the runner and the config resolve two different copies, so pinning it independently of what @wordpress/scripts expects carries its own risk. Flagged for a deliberate decision.

Worth considering separately

@wordpress/scripts is used for exactly two subcommands, test-playwright and test-unit-js, but it brings webpack, eslint, babel and jest in full — including webpack-dev-server, the dev server for a start script this project does not have. Most of the remaining advisories live in that unused surface. Replacing those two subcommands with direct playwright test and jest invocations would remove the bulk of them at the root, with no pins to maintain.

@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@erseco erseco changed the title chore(deps): patch vulnerable transitive dependencies via npm overrides chore(deps): patch transitive vulnerabilities, lift the wp-scripts cap, resync WASM assets Jul 28, 2026
Every open Dependabot alert is npm, in package-lock.json, and transitive
through @wordpress/scripts. None are Composer, so the ranges pinned in
#232 are not involved.

Two changes, no overrides:

1. Lift the version cap. .github/dependabot.yml held @wordpress/scripts
   below 32.3.0 and @wordpress/e2e-test-utils-playwright below 1.47.0,
   because those releases pointed their package "exports" at TypeScript
   source that the Playwright runner cannot load. Upstream reverted that:

     1.46.0  exports["."].default = ./build/index.cjs
     1.47.0  exports["."].default = ./src/index.ts     <- the breakage
     1.48.0  exports["."].default = ./src/index.ts
     1.50.0  exports["."].default = ./build/index.js   <- fixed
     1.51.0  exports["."].default = ./build/index.js

   So the cap is removed and both packages track latest again.

2. npm update, which moves the tree to patched releases already allowed
   by the ranges the parents declare. The lockfile had simply gone stale.

Distinct advisories drop from 34 to 17. Measured across four installs,
each npm ci followed by npm audit:

  main, untouched                     34
  upgrade alone                       33
  upgrade + npm update (this commit)  17
  upgrade + 18 forced overrides        6

An earlier revision of this branch took the last route. It was dropped:
half the reduction needs no overrides at all, and the remaining eleven
advisories can only be bought by forcing majors upstream never tested
together - webpack-dev-server 4->5, uuid 8->11, serialize-javascript
6->7, markdown-it 12->14, linkify-it 3->5, adm-zip 0.5->0.6 - in chains
this project never executes. There is no build step and no dev server,
so webpack, postcss and svgo are installed but never run. Those alerts
will clear as @wordpress/scripts moves, without forced pins to maintain.

Note that npm audit's total rises from 43 to 64 while distinct advisories
halve: it counts packages affected, and the unfixable brace-expansion
advisory cascades widely. Only 5.0.8+ is patched there, and v5 exports
{ expand } instead of the callable default v1/v2 exported, so forcing it
throws "expand is not a function" in minimatch. Verified by running it.

Verified: npm ci exits 0, test:unit-js 9 tests, PHPUnit 1808 tests,
Playwright 72 passed with 1 pre-existing failure - document-types.spec.js
fails identically on main with no changes applied, so it is not a
regression from this upgrade.
@erseco
erseco force-pushed the chore/npm-security-overrides branch from d9e2b4f to cfe7ba1 Compare July 28, 2026 07:49
@erseco erseco changed the title chore(deps): patch transitive vulnerabilities, lift the wp-scripts cap, resync WASM assets chore(deps): upgrade @wordpress/scripts to 33 and refresh the lockfile Jul 28, 2026
@erseco
erseco merged commit 1b5b82f into main Jul 28, 2026
12 checks passed
@erseco
erseco deleted the chore/npm-security-overrides branch July 28, 2026 08:44
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