fix(deps): patch additional Dependabot vulnerabilities (follow-up to #24369)#24371
fix(deps): patch additional Dependabot vulnerabilities (follow-up to #24369)#24371pranav-new-relic wants to merge 2 commits into
Conversation
Adds yarn resolutions to force patched versions of transitive dependencies flagged by Dependabot. Closes ~34 alerts including: - shell-quote (CVE-2026-9277, CRITICAL) - form-data (CVE-2025-7783, CRITICAL) - @babel/plugin-transform-modules-systemjs, basic-ftp, engine.io, fast-uri, fast-xml-parser, follow-redirects, on-headers, semver, svgo, tough-cookie, trim, webpack, xml2js, ws, serialize-javascript, qs (HIGH/MEDIUM) - @tootallnate/once, brace-expansion, cookie, cross-spawn, dottie, lodash, node-forge, tmp (MEDIUM/LOW) Direct dep bumps: - simple-git 3.32.3 -> 3.36.0 (dev) - sequelize 6.21.3 -> 6.37.8 (runtime) Skipped packages requiring major-version bumps (multer 1->2, undici 5->6, file-type 16->21, sanitize-html 1->2, esbuild 0.15->0.25, js-cookie 2->3, ip-address 9->10, gatsby-transformer-remark 5->6, uuid 9->12, sharp 0.30->0.32) and packages with multi-branch trees that yarn 1.x classic cannot selectively resolve (minimatch 3.x/9.x, nth-check 1.x/2.x, postcss 7.x/8.x, katex 0.13/0.16, js-yaml 3.x/4.x, path-to-regexp 0.1/6, yaml 1.x/2.x, ajv 6.x/8.x). Also skipped mdast-util-to-hast: a global ^13.2.1 resolution broke @mdx-js/mdx@2.0.0-next.8 (CJS) which require()s mdast-util-to-hast (ESM-only since v12), causing ERR_REQUIRE_ESM in verify-mdx and test:esm. The CJS/ESM split across versions 9/10 vs 12/13 is unfixable without selective per-version resolution. Verified: yarn install, yarn lint, yarn test:cjs (24/24 suites pass), direct ESM tests (82/82 pass).
Builds on #24369. Adds patch-package + a security-postinstall script plus more global yarn resolutions. Closes 25+ additional Dependabot alerts that #24369 had to skip due to yarn 1.x classic limitations. New mechanisms: - patches/path-to-regexp+0.1.12.patch — backports the 0.1.13 ReDoS fix to the 0.1.x branch (express still pins 0.1.12 exact, so a resolution can't reach it) — closes alert #297 - scripts/security-postinstall.js — overlays vulnerable nested copies of minimatch (recursive-readdir, graphql-config) with the hoisted safe top-level — closes alert #83 New global resolutions: - katex ^0.16.21 -> closes #218 #219 #220 #245 (medium) - yaml ^2.8.3 -> closes #287 #290 (medium) - postcss ^8.5.10 -> closes #129 #314 (medium) - js-cookie ^3.0.7 -> closes #336 (high) - multer ^2.1.1 -> closes #197 #198 #200 #203 #265 #266 #271 (high) - undici ^6.24.0 -> closes #277 #278 #279 #280 (high/medium) - ip-address ^10.1.1 -> closes #325 (medium) - esbuild ^0.25.0 -> closes #195 (medium) Tried but reverted: - ajv ^8.18.0 -> @eslint/eslintrc requires AJV 6 API - nth-check ^2.0.1 -> 1.x consumers do require('nth-check')() which fails in 2.x (default export is now namespaced) - file-type ^21.3.1 -> ESM-only, breaks gatsby-core-utils CJS require - sharp ^0.32.6 (resolution) -> gatsby-plugin-sharp peers ^0.30.7 which 0.32.x doesn't satisfy; yarn 1 can't override peer ranges Verified: yarn install (clean and post-rm), yarn lint, yarn test:cjs (24/24), direct ESM tests (82/82), verify-mdx subset, sharp + multer + undici + esbuild module-load smoke tests, sharp PNG processing.
|
Hi @pranav-new-relic 👋 Thanks for your pull request! Your PR is in a queue, and a writer will take a look soon. We generally publish small edits within one business day, and larger edits within three days. Please ensure the propsed changes look good by building it first in your local environment. Refer to this contribution guide to get the site up and running in your local. If you really require a preview url, reach out to one of the writers and they will generate one for you. |
|
Closing — too risky to land as-is. The mechanisms here (a custom postinstall script that overlays nested
The tradeoff (~25 more alerts closed vs. the chance of breaking gatsby develop / production build / preview deploys in subtle ways) doesn't feel right. Tests passing isn't enough confidence here. Plan: merge #24369 first (which is already conservative and CI-clean), let things settle, then come back to the remaining alerts with a different strategy — likely scoped to specific packages with paired runtime verification, or as part of the Gatsby v5 / AWS SDK v3 migration work where the upstream deps move forward naturally. |
Summary
Follow-up to #24369. This PR patches an additional 25 Dependabot alerts that #24369 had to skip because yarn 1.x classic resolutions cannot selectively upgrade transitive deps in multi-branch trees.
Two new mechanisms were introduced:
patch-packagefor security patches that need to apply to a specific package version without bumping it (used here forpath-to-regexp 0.1.12→ backporting the0.1.13fix).scripts/security-postinstall.js— a small idempotent script that runs afterpatch-packageand overlays vulnerable nested copies of a package with the safe hoisted top-level copy (used here forminimatch 3.0.4). Self-repairing on every install.All open Dependabot alerts →
✅ Fixed — High
minimatchrecursive-readdir/graphql-config)multer^2.1.1multer^2.1.1multer^2.1.1multer^2.1.1multer^2.1.1multer^2.1.1multer^2.1.1undici^6.24.0undici^6.24.0path-to-regexpjs-cookie^3.0.7✅ Fixed — Medium
postcss^8.5.10esbuild^0.25.0katex^0.16.21katex^0.16.21katex^0.16.21katex^0.16.21undici^6.24.0undici^6.24.0yaml^2.8.3yaml^2.8.3postcss^8.5.10ip-address^10.1.1🔄 Will auto-close on next rescan (a side-effect of the resolutions above)
mdast-util-to-hast^13.0.0consumers. This PR didn't need to do anything; included here for completenessundici>=7.0.0; we now have only6.xafter the resolution⏭ Tried but reverted
These were investigated and abandoned. Each row documents why so the next attempt doesn't repeat the experiment.
ajv ^8.18.0@eslint/eslintrc/lib/shared/ajv.jsinstantiates AJV with the v6 keyword API. Forcing 8.x crashesyarn lintwith "ajv-keywords" loader errorsnth-check ^2.0.1nth-check2.x exposes{ compile, parse, default }instead of a callable default export. Three transitive consumers (gatsby-transformer-yaml/unist-util-select,rehype-add-classes/hast-util-select,static-site-generator-webpack-plugin/css-select) dorequire('nth-check')(formula)and would crashfile-type ^21.3.1gatsby-core-utils/dist/fetch-remote-file.jsdoesrequire('file-type').ERR_PACKAGE_PATH_NOT_EXPORTEDsharp ^0.32.6(resolution)gatsby-plugin-sharp@4.25.1peers^0.30.7which0.32.xdoesn't satisfy. yarn keeps the 0.30.7 nested copies untouched. Would needpatch-packageon each gatsby plugin'spackage.jsonto widen the range — too invasive for a security patchsharp ^0.32.6(direct dep)gatsby-transformer-remark ^6.3.2recursive-readdir/minimatch: ^3.1.2⏭ Still skipped — needs cross-cutting work
sanitize-htmlgatsby-transformer-remark@5.24.0. Patch only in2.x. Unblocked by upgradinggatsby-transformer-remark(which itself wants Gatsby v5)gatsby-transformer-remarkgatsby-plugin-sharpsharpaxioslodash.pick4.17.19, but max publishedlodash.pickis4.4.0. CVE applies tolodash(already fixed)vue-template-compilerrequestaws-sdkjs-yamljs-yaml@^3.14.0directly viasafeLoad.4.xremovedsafeLoad. Migrating our scripts offsafeLoadwould unblockajv@eslint/eslintrcblocksnth-checkfile-typeTest plan
rm -rf node_modules && yarn installsucceeds; postinstall runs cleanlyyarn lint(1 pre-existing react-hooks warning)yarn test:cjs— 24/24 suitesscripts/actions/__esm-tests__yarn verify-mdxon subset (src/install)multer,undici,esbuild,ip-address,js-cookiesharpPNG processing smoke test (still on 0.30.7 in this PR — unchanged from fix(deps): patch 34 Dependabot vulnerabilities via resolutions #24369)run tests,run verify,run linter,run validation