Repository navigation
🔒 修复 pnpm audit 全部安全警告 (20260921) - #1760
Merged
Merged
Conversation
pnpm audit 报告 1 项 critical、26 项 high、20 项 moderate、3 项 low 漏洞(websocket-driver、 brace-expansion、js-yaml、shell-quote、body-parser、dompurify、fast-uri、react-router、 postcss、hono、nanoid、fast-xml-parser、browserslist、@humanfs/node、qs、vitest 等)。 多数漏洞源于 pnpm-lock.yaml 落后于 package.json 中已允许的 semver 范围,通过刷新以下直接依赖的 锁定版本即可在现有 range 内修复: dompurify、fast-xml-parser、react-router-dom、webdav、 postcss、vitest/@vitest/coverage-v8、eslint、postcss-loader,以及将 @modelcontextprotocol/sdk 从精确锁定的 1.29.0 升至 1.30.0。 其余漏洞位于传递依赖(brace-expansion、js-yaml、hono、browserslist、baseline-browser-mapping、 @humanfs/node、qs),其父包自身的 semver range 已允许修复版本,但 pnpm 不会在未显式指定时跳到该 版本,故通过 pnpm.overrides 显式钉住这些包的最低安全版本,均在各自父包声明的兼容范围内。 剩余 1 项 moderate、7 项 high、1 项 low 均集中在 @rspack/cli > @rspack/dev-server > webpack-dev-server 链路: @rspack/dev-server 在 1.x 全系列中硬编码精确版本 webpack-dev-server@5.2.2(不可通过 range 修复),需要升级到 @rspack/cli 2.x(已改用 @rspack/dev-middleware,不再依赖 webpack-dev-server)才能修复,属于构建工具的破坏性大版本升级, 放到单独的 PR 处理。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
复用上个提交遗留的 pnpm.overrides(package.json)方式与本仓库既有的 pnpm-workspace.yaml 精确父版本覆盖表(见 #1350)并不一致,且未覆盖 @rspack/cli > @rspack/dev-server > webpack-dev-server 链路的剩余漏洞。 改为在 pnpm-workspace.yaml 现有覆盖表内就地刷新,遵循同一套 "parent@version>package": "exact-version" 约定: - webpack-dev-server 5.2.5→5.2.6、shell-quote→1.10.0、fast-uri→3.1.7、 qs/body-parser→6.16.0/1.20.8,均在各自父包(webpack-dev-server、 launch-editor、ajv、express)自身声明的兼容范围内,且都是 rspack 1.x 全系列可达的版本,无需迁移到 rspack 2.x。 - 新增 @modelcontextprotocol/sdk>hono、eslint>@humanfs/node、 minimatch>brace-expansion(webdav 与 crx/archiver 两条链路分别覆盖)、 @babel/helper-compilation-targets>browserslist>baseline-browser-mapping 的父版本精确覆盖项。 - 删除上个提交在 package.json 引入的 "pnpm.overrides" 块,避免与 pnpm-workspace.yaml 的覆盖表并存造成后续维护混乱。 - concurrently 升至 10.0.5(仍在既有 ^10.0.3 range 内),其自带的 shell-quote 依赖已原生修复,无需额外覆盖项。 所有候选版本均通过 minimumReleaseAge(7 日冷却期)校验。 pnpm audit: 0 critical / 0 high / 0 moderate / 0 low(先前提交后仍剩 1 moderate、7 high、1 low 均集中于 rspack dev-server 链路)。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
PR 首版提交后又披露了一批新公告,pnpm audit 重新报出 3 critical / 10 high / 8 moderate / 2 low。按原 PR 的口径(父包声明范围内取通过 7 日冷却期的最低修复版本)跟进: - 直接依赖:@modelcontextprotocol/sdk 1.30.0→1.31.0(OAuth 凭据外发), dompurify ^3.4.16(IN_PLACE 相关 XSS)。 - 刷新既有覆盖项目标:fast-uri 3.1.8、shell-quote 1.11.0、 brace-expansion 1.1.21 / 2.1.7,sdk 覆盖键随版本改为 1.31.0。 - 父包范围内可直接重新解析的传递依赖只刷新锁文件、不新增覆盖项: ip-address 10.7.2、proxy-addr 2.0.8、compression 1.8.2、 source-map-js 1.2.2、brace-expansion 5.0.12(typescript-eslint 链)。 - concurrently@10.0.5 精确钉住 shell-quote@1.9.0 且尚无新版,是唯一越过父包 声明范围的覆盖项(同主版本 minor),已在注释中说明。 剩余 1 项 high:braces@3.0.3(经 @rspack/dev-server>chokidar@3),上游无任何修复版本, 且本项目只用 rspack watch/build、不走 dev-server。
覆盖表累积到 24 项,其中绝大多数目标版本本就落在父包声明的 semver 范围内, 只是旧锁文件没有重新解析。这类条目把版本钉死在具体父版本上,父包一升级就静默失效, 每次跟进漏洞都要连带改键。 逐项验证:清空覆盖表后重新解析,pnpm audit 只剩 webpack-dev-server 链与 concurrently 两处;再按需加回,最终只保留 3 项父包范围之外的覆盖: - @rspack/dev-server@1.1.5 精确钉住 webpack-dev-server@5.2.2 - sockjs 使用上游未发布修复(去掉 uuid@8)的 tarball - concurrently@10.0.5 精确钉住 shell-quote@1.9.0 express 4.x 的 qs 改为把锁文件刷新到 express@4.22.3(自带 qs ~6.16.0, 在 webpack-dev-server 的 ^4.22.1 范围内)。其余解析变化仅 esbuild 0.28.2、 @peculiar/asn1-* 2.10.0、pkijs 3.4.1、@noble/hashes 1.8.0(均为 dev-server/vite 链的范围内升级)。 pnpm audit 结果与精简前一致:仅剩上游无修复版本的 braces@3.0.3。
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
pnpm auditreported 1 critical, 26 high, 20 moderate, 3 low vulnerabilities (websocket-driver, brace-expansion, js-yaml, shell-quote, body-parser, dompurify, fast-uri, react-router, postcss, hono, nanoid, fast-xml-parser, browserslist, @humanfs/node, qs, vitest, webpack-dev-server, and more). This PR resolves all of them —pnpm auditnow reports 0 critical / 0 high / 0 moderate / 0 low.package.jsonranges:dompurify,fast-xml-parser,react-router-dom,webdav,postcss,vitest/@vitest/coverage-v8,eslint,postcss-loader,concurrently.@modelcontextprotocol/sdkfrom1.29.0to1.30.0.pnpm-workspace.yamloverridestable (the precise"parent@version>package": "exact-version"convention from 修复所有 npm vulnerability #1350) to refresh stale entries and add new ones for transitive vulnerabilities whose immediate parent's own semver range already permits the patched version but pnpm won't reach for it without an explicit override:brace-expansion(both thewebdav>minimatchandcrx>archiver>glob>minimatchchains, covered separately since they resolve to different minimatch majors),js-yaml,hono,browserslist/baseline-browser-mapping,@humanfs/node.@rspack/cli→@rspack/dev-server→webpack-dev-serverchain (websocket-driver, shell-quote, webpack-dev-server itself, body-parser, qs, fast-uri) turned out to be fixable the same way, in-place on the existing@rspack/dev-server@1.1.5release, by bumping the override targets (webpack-dev-server5.2.5→5.2.6,shell-quote→1.10.0,fast-uri→3.1.7,qs/body-parser→6.16.0/1.20.8) — all within their respective parents' (webpack-dev-server,launch-editor,ajv,express) own declared compatible ranges. No major-version bump of@rspack/cli/@rspack/corewas needed, so there's no separate rspack-migration PR.minimumReleaseAge: 10080(7-day) cooldown gate; where the newest patched release was too fresh (e.g.brace-expansion1.1.21/2.1.7,fast-uri3.1.8, published within the last week), used the next-older release that still clears the vulnerable-version threshold (brace-expansion1.1.18/2.1.4,fast-uri3.1.7).An earlier revision of this PR added a parallel
pnpm.overridesblock directly inpackage.jsonand, based on a stale read of the situation, proposed a separate follow-up PR to bump@rspack/cli/@rspack/coreto 2.x as the only way to close the remaining dev-server-chain findings. Neither was correct: thepackage.jsonblock duplicated (and could drift from) the existingpnpm-workspace.yamloverrides mechanism, and the rspack major bump turned out to be unnecessary once the override targets were refreshed. Both have been corrected in the current revision.Test plan
pnpm audit— 1 critical / 26 high / 20 moderate / 3 low → 0 / 0 / 0 / 0pnpm run typecheck— passespnpm run build— passes (only pre-existing bundle-size/critical-dependency warnings)pnpm run test:ci— 373 test files / 4837 tests passpnpm run lint:ci— passesdev/buildscripts invoke plainrspack(watch mode), neverrspack serve, so the@rspack/dev-server/webpack-dev-servercode path isn't exercised by this project's own workflow either way — the fix was still applied for defense in depth and to clear the audit.🤖 Generated with Claude Code
Follow-up (2026-10-08)
2f3589f — new advisories. Advisories published after the first revision brought
pnpm auditback to 3 critical / 10 high / 8 moderate / 2 low. Direct dependencies:@modelcontextprotocol/sdk1.30.0→1.31.0 (OAuth credential leak; we don't pass anauthProvider) anddompurify^3.4.16 (IN_PLACE XSS;sanitize.tsdoesn't use IN_PLACE). Transitive fixes:fast-uri,shell-quote,brace-expansion,ip-address,proxy-addr,compression,source-map-js.6486dde — override table trimmed from 24 entries to 3. Most entries pinned a version the parent's own semver range already allowed; the old lockfile simply hadn't re-resolved. Those entries are keyed to an exact parent version, so they silently stop applying when the parent is bumped, and every vulnerability follow-up had to re-key them. I cleared the table, re-resolved, and added back only what
pnpm auditstill needed. All 3 survivors are outside the parent's range:@rspack/dev-server@1.1.5pinswebpack-dev-server@5.2.2exactlysockjstarball (unreleased upstream fix that dropsuuid@8)concurrently@10.0.5pinsshell-quote@1.9.0exactly; 1.11.0 is the same major, and concurrently onlyquote()s plain argv stringsThe express 4.x
qsissue is now fixed by moving the lockfile toexpress@4.22.3, which shipsqs ~6.16.0and is within webpack-dev-server's^4.22.1range. Other resolution changes from the re-resolve are all in-range and on the dev-server/vite chains: esbuild 0.28.2,@peculiar/asn1-*2.10.0, pkijs 3.4.1,@noble/hashes1.8.0. The comment at the top ofoverrides:records the rule: in-range fixes go through a lockfile refresh.Remaining: 1 high.
braces@3.0.3via@rspack/cli>@rspack/dev-server>chokidar@3. No patched release exists, and this project never runsrspack serve.Verified on 6486dde:
pnpm install --frozen-lockfile, typecheck,lint:ciand build pass, andCI=1 pnpm run test:cipasses 373 files / 4837 tests.