🔒 修复 pnpm audit 全部安全警告 (20260921) - #1760
Open
cyfung1031 wants to merge 3 commits into
Open
cyfung1031 wants to merge 3 commits into
cyfung1031 wants to merge 3 commits into
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>
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