Skip to content

deps: override npm to ^11 to clear bundled brace-expansion ReDoS#301

Merged
QSchlegel merged 1 commit into
preprodfrom
claude/deps-npm-override
Jun 14, 2026
Merged

deps: override npm to ^11 to clear bundled brace-expansion ReDoS#301
QSchlegel merged 1 commit into
preprodfrom
claude/deps-npm-override

Conversation

@QSchlegel

Copy link
Copy Markdown
Collaborator

Summary

Clears the last remaining Dependabot alert (#28brace-expansion <= 2.0.1 ReDoS, GHSA-v6h2-p8h4-qcjw, low) by overriding the npm package to ^11.

Root cause

The vulnerable brace-expansion@2.0.1 only ever appears bundled inside npm@9.9.4, which @cardano-sdk/crypto pulls in via npm@^9.3.0. That dependency is spurious@cardano-sdk/crypto@0.2.3 declares npm but never imports it in its compiled output. So the only thing it contributes is npm's large vendored dependency tree (the vulnerable brace-expansion, plus most of the noise behind npm audit's inflated count).

Why an override on npm (not brace-expansion)

  • npm overrides cannot reach into a bundled package's vendored node_modules, so a brace-expansion override leaves the bundled copy untouched.
  • A blanket brace-expansion override is actively harmful: it downgrades the legitimate brace-expansion@5.0.6 that glob@11 / minimatch@10 depend on (they need the named-expand 5.x export), breaking glob. Confirmed and discarded.

Overriding npm^11 (resolves to 11.17.0) swaps in a bundle that ships the patched brace-expansion@5.0.6. It's safe precisely because @cardano-sdk/crypto never executes npm.

Result

  • Zero vulnerable brace-expansion instances remain in the tree (root 1.1.14 is ≥ the 1.1.12 patch; the 2.0.1/1.1.11 copies from npm@9's bundle are gone).
  • glob / minimatch still resolve and brace-expand correctly.
  • Lockfile churn is contained to the node_modules/npm subtree, plus a harmless dedupe of unused optional WebAuthn deps (@simplewebauthn/*) under @auth/prisma-adapter (this app uses next-auth with PrismaAdapter only — no WebAuthn).

Verification

  • tsc --noEmit clean.
  • next build --webpack succeeds (only the pre-existing whisky WASM async/await warnings).

Context

The other 14 Dependabot alerts were already remediated in the committed lockfile (next@16.2.6, form-data@4.0.5, pbkdf2@3.1.5, ip/tar-fs absent, @octokit/*, prismjs, @babel/runtime, etc.) — they were stale (Dependabot hadn't re-scanned since the fixes landed) and have been dismissed.

Note: a cleaner long-term fix is upstream — @cardano-sdk/crypto should drop its unused npm dependency. Worth raising with MeshSDK during the Mesh 2.0 migration.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Jun 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
multisig Ready Ready Preview, Comment Jun 14, 2026 12:06pm

Request Review

The last open Dependabot alert (brace-expansion <=2.0.1, GHSA-v6h2-p8h4-qcjw,
ReDoS) was a copy bundled inside npm@9.9.4, which @cardano-sdk/crypto pulls in
via `npm@^9.3.0`. That npm dependency is spurious — @cardano-sdk/crypto declares
it but never imports it in its compiled code — so it only drags in npm's vendored
dependency tree (including the vulnerable brace-expansion and the noise behind
`npm audit`'s large count).

A `brace-expansion` override can't fix this: npm overrides don't reach into a
bundled package's vendored node_modules, and a blanket brace-expansion override
instead downgrades the legitimate brace-expansion@5.x that glob@11 / minimatch@10
require (named `expand` export), breaking glob.

Override `npm` to ^11 instead (resolves to 11.17.0), whose bundle ships the
patched brace-expansion@5.0.6. Net effect:
- zero vulnerable brace-expansion instances remain in the tree
- glob / minimatch still resolve and brace-expand correctly
- safe because @cardano-sdk/crypto never executes npm

The lockfile was regenerated with npm 10.9.3 (matching CI's node:22-slim, not the
local npm 11) via `npm install --package-lock-only`, so it stays in sync for the
`npm ci` CI runs — npm 11 drops @auth/core's optional @simplewebauthn entries that
npm 10 keeps, which made `npm ci` fail. Churn is limited to the npm subtree.

The other 14 Dependabot alerts were already remediated in the committed lockfile
(next@16, form-data@4.0.5, pbkdf2@3.1.5, ip/tar-fs absent, etc.) and dismissed.

Verified: `npm ci` (npm 10.9.3) succeeds; tsc --noEmit clean; next build --webpack succeeds.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@QSchlegel QSchlegel force-pushed the claude/deps-npm-override branch from 86b7735 to cab9df1 Compare June 14, 2026 12:03
@QSchlegel QSchlegel merged commit a61f9a5 into preprod Jun 14, 2026
6 of 7 checks passed
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