deps: override npm to ^11 to clear bundled brace-expansion ReDoS#301
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
c5e197b to
86b7735
Compare
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>
86b7735 to
cab9df1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Clears the last remaining Dependabot alert (#28 —
brace-expansion<= 2.0.1 ReDoS,GHSA-v6h2-p8h4-qcjw, low) by overriding thenpmpackage to^11.Root cause
The vulnerable
brace-expansion@2.0.1only ever appears bundled insidenpm@9.9.4, which@cardano-sdk/cryptopulls in vianpm@^9.3.0. That dependency is spurious —@cardano-sdk/crypto@0.2.3declaresnpmbut never imports it in its compiled output. So the only thing it contributes is npm's large vendored dependency tree (the vulnerablebrace-expansion, plus most of the noise behindnpm audit's inflated count).Why an override on
npm(notbrace-expansion)node_modules, so abrace-expansionoverride leaves the bundled copy untouched.brace-expansionoverride is actively harmful: it downgrades the legitimatebrace-expansion@5.0.6thatglob@11/minimatch@10depend on (they need the named-expand5.x export), breakingglob. Confirmed and discarded.Overriding
npm→^11(resolves to 11.17.0) swaps in a bundle that ships the patchedbrace-expansion@5.0.6. It's safe precisely because@cardano-sdk/cryptonever executesnpm.Result
brace-expansioninstances remain in the tree (root1.1.14is ≥ the1.1.12patch; the2.0.1/1.1.11copies from npm@9's bundle are gone).glob/minimatchstill resolve and brace-expand correctly.node_modules/npmsubtree, 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 --noEmitclean.next build --webpacksucceeds (only the pre-existing whisky WASMasync/awaitwarnings).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-fsabsent,@octokit/*,prismjs,@babel/runtime, etc.) — they were stale (Dependabot hadn't re-scanned since the fixes landed) and have been dismissed.🤖 Generated with Claude Code