Repository navigation
[PR] fix(security): bump bundled node-forge to ^1.4.1 and undici to ^7.30.1 - #5739
ranxianglei wants to merge 3 commits into
Conversation
…ual (#4599) 01fcc5d (#5656/#5584, merged via #5687) diverts tool-less dsh single-shot requests onto the verbatim side lane (kernel no-touch); the residual for main turn 1 is documented in the commit's own comment. Five pre-existing pins assumed turn 1 rides the full pipeline and went born-red at merge (master red since; every PR head inherits it). Test-only realignment codifying the documented behavior: - issue2419/2446/2447/2481 guard-stamp subtests: two turns; the BLOCKED ref is witnessed on the first FULL-PIPELINE turn (turn 2). No fold can happen before turn 2 (nothing compressible, no action surface), so protection against every possible fold is unchanged. - issue2817: stats.requests off by one (turn 1 uncounted); the persona-fold teeth are intact, assertions shifted -1. - issue5403 A/B golden: turn 0 rides the side lane in BOTH phases (the gate ignores the rollout env), so rb[0] is unstamped by design; stamps resume at turn 1. Byte equality holds at i=0 (both phases forward verbatim). No src/, kernel/, config, or version changes. Locally green: all six files + side-lane-invariants + issue5656-single-shot-sidecar + dsh-persona-fingerprint.
node-forge and undici are devDependencies inlined into every dist/ bundle via tsup noExternal (tsup.config.ts), so the published artifact ships these copies even though npm audit / SCA cannot see them in a consumer's installed tree. The lockfile pinned node-forge 1.4.0 (11 advisories) and undici 7.29.0 (18 advisories). Raise both devDependency floors to exclude the vulnerable versions and re-resolve the lockfile: node-forge 1.4.0 -> 1.4.3, undici 7.29.0 -> 7.30.2. No bili source changes; dist/ is built by CI at publish time, so the next release re-inlines the patched copies. Verified locally: build + typecheck green, and the post-fix markers (_encodeDigestInfo in node-forge rsa.js, writableNeedDrain in undici receiver.js) now appear in all bundles that carry these packages. Closes #5730
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.8250-pr.5739.554e781This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5739.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复 —— 镜像 open [PR] 行中没有其他条目针对同一主题(bundled node-forge/undici 提版);上游对应 issue 为 #5730(Dependency security: dist/ bundles node-forge 1.4.0 and undici 7.29.0),本 PR 的 标签: bug + scope/ci + p2(安全缺陷类;依赖提版属构建面;可达性低、能用但有明确问题 → p2) 这是已完成的 agent PR(正文带 ework-agent-pr 标记),不重做——拉分支核对代码 + 查 CI 状态,报结论。 核对进展(初步):
CI check 结果出来后给完整审核结论(八问)。 |
(ai: vllm-qwen/qwen3.8-27b) 本次运行结论:PR 红 = 继承性 master 红,不是本 PR 的问题;ci-fixes 合并已在分支上,新 head 全部检查绿。 查重: 不涉及(CI 自动修复车道,非新立项;诊断依据 #4599 CI 总控已有登记,未重复开单)。 结构化八问:
最终 CI 状态(head 4eb7156,镜像缓存卡在半快照后按例外规则单次直连 API 核对,非轮询):主 CI workflow run 42019183446 = completed success(11:28:04Z → 11:39:54Z,含全部 12 个测试分片 + 静态门禁);同 head 其余 11 个 workflow(ci-image、E2E real codex、e2e-codex-persona、e2e-dsh-plugin-lane、e2e-native-{pi,dsh,opencode}、e2e-pi-codex-ws、e2e-fake-codex、e2e-local-registry、Windows codex overlay)全部 success。11:28:03Z 那批重复触发的 run 已被 GitHub 自动取消,不计入。 判定:本 PR 侧 CI 已全绿,无需决策项,本会话无新增推送;PR 可进入正常 review/合入流程。备注一条(超本 PR 范围):ci-fixes → master 的 #5718 仍待 owner 合入,否则后续每个 PR 会继续继承这波红。 |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
VERDICT: APPROVE (clean, minimal, independently verified).
Note: GitHub rejects a formal APPROVE from the PR author's own account (422 "Can not approve your own pull request"), so this review is posted as COMMENT carrying the approval verdict. A human approve + merge is still required (security-related → human-gated per §7.4 anyway).
What I checked (independently, not from the PR text):
- Diff scope: exactly two devDependency floor bumps (
node-forge ^1.4.0→^1.4.1,undici ^7.29.0→^7.30.1) plus their lockfile entries — 4 lines inpackage.json, 8 inpackage-lock.json, zero other churn. Noversionfield touched, no src/, no kernel/. - Supply chain: lockfile integrity hashes match registry.npmjs.org byte-for-byte for
node-forge@1.4.3andundici@7.30.2. 1.4.3 is the latest 1.x; 7.30.2 is the latest 7.x — deliberately staying on major 7 avoids an 8.x behavior jump (correct call). - Advisory coverage: spot-checked 4 of the 29 GHSA entries against the GitHub advisory API — first-patched versions (forge
1.4.1; undici7.29.1/7.30.1) are all ≤ the locked versions. The one forge advisory with no official patched version (GHSA-86w9-cpqp-85rv, nested DigestAlgorithm) is already disclosed in #5730 as addressed by 1.4.1's canonical-DigestInfo enforcement — accepted residual. - Usage sites:
node-forgeonly insrc/ca.ts(local MITM CA);undiciinsrc/fetch-util.ts,src/responses-ws.ts,src/upstream-proxy.ts. Both sit intsup.config.ts:61noExternal→ inlined intodist/;dist/is git-ignored, so the next release re-inlines the patched copies with no further action. - No second copy ships:
kernel/andpi-subagents/lockfiles do not pin either package. Theundici 8.5.0entry inpi-subagents/package-lock.jsonis a transitive of@earendil-works/pi-coding-agent(dev-only; stubbed out of bili bundles per #2186, andpi-subagents/srcnever imports undici) — it reaches no artifact. - Durable guard: raising the floor (not just the lock) prevents any future fresh resolve from landing back on the vulnerable versions. Good hygiene.
- Riding-along ci-fixes merge (
0470bec62): test-only realignment of five dsh regression pins codifying the documented #5656 side-lane residual (#4599 CI-coordination sentinel pattern). Verified test-only — no src/kernel/config/version changes. Legitimate per CI-failure coordination policy. - CI: 30/30 checks green on head
4eb71561e(mirror cache, no gh polling).
Structured summary (八问)
- 是什么问题: 发布的 dist/ 捆绑物里带着 node-forge 1.4.0 和 undici 7.29.0 —— 29 个 CVE,且因 devDep 内联机制对 npm audit / SCA 完全不可见。
- 什么原因导致的: lockfile 钉在修复前版本;esbuild
noExternal内联使这些副本只存在于 dist 字节里,消费方依赖树中不存在。 - 影响范围与严重程度: 每个安装副本都携带漏洞字节;#5730 评估外部可达性低(forge 仅本地 CA 用、受影响的 undici 路径需用户自配上游或 Responses WS),但按安全账本仍属必须修。
- 怎么修复的: 抬 devDependency 下限排除漏洞版本 + lockfile 重解析(1.4.0→1.4.3、7.29.0→7.30.2),零代码改动,下次发版自动重新内联。
- 是否有回归问题: 无。逐项过既有行为:CA/MITM 路径(
tests/mitm.test.ts绿)、fetch/dispatcher 路径(real-client e2e 车道全绿)、wire/配置/持久化零触碰;两个 bump 都在 semver 兼容范围内,无 bili 侧 API 变化。行为变更已按规范披露(旧值→新值:捆绑的库版本)。 - 是否破坏缓存: 不涉及——未触碰缓存/重试/游标/去重逻辑。
- 是否改了设计方向: 不涉及。
- 是否引入新配置: 无。
House notes: branch naming / fix(security): convention / Closes #5730 / behavior-change disclosure all compliant. Security-related → stays human-gated per §7.4; merge remains manual.
PR #5739 审阅完成:结论 APPROVE(已作为 COMMENT 态 review 发布——GitHub 禁止作者账号自批,需人工 approve+merge;安全类按 §7.4 本就人工门禁)。独立核验:lockfile integrity 与 npm registry 逐字节一致、29 条 advisory 抽查 first-patched 版本均 ≤ 锁定版(forge 1.4.3 / undici 7.30.2)、node-forge 仅 src/ca.ts、undici 三处使用点均在 tsup noExternal 内联路径、pi-subagents 的 undici 8.5.0 为 dev-only 传递依赖不进产物;CI 30/30 绿(head 4eb7156);diff 仅两行 spec + lockfile,无其他发现可顺手修。 |
(ai: vllm-qwen/qwen3.8-27b) PR #5739 审核完成:通过,建议 owner 人工合并(涉安全面,§7.4 要求 human-only merge) 结构化八问:
独立核验(不只信 PR 描述):
CI 过程(先红后绿):
行为变更披露(Deliverables #4):唯一行为差异 = bundle 内联的是补丁版而非漏洞版(PR 正文已披露;semver 兼容、无 API 变化)。无其他行为漂移。 合并判定:审核通过、可合。按 §7.4 安全相关项(node-forge = MITM CA 库)不可自动合并,请 @ranxianglei 手动合并:#5739 (当前 open、mergeable=true;mergeable_state=blocked 为分支保护人工门禁所致,非 CI 红)。 |
[bot] 🏷 review-worker-r1 收工确认:PR #5739(node-forge ^1.4.1 / undici ^7.30.1)审阅完成——结论 APPROVE,已作为 COMMENT 态 GitHub review 发布(review id 5785178896;GitHub 禁止作者账号自批,需人工 approve+merge,安全类按 §7.4 本就 human-only)。核验要点:lockfile integrity 与 npm registry 逐字节一致、advisory 抽查 first-patched ≤ 锁定版(1.4.3 / 7.30.2)、两包均在 tsup noExternal 内联路径且 dist/ 未入库(下次发版自动重内联补丁字节)、diff 仅 devDeps floor + lockfile 共 10 行无其他 churn、CI head 4eb7156 全绿。无顺手修项、未触 kernel/(无需决策流)。完整八问与 CI 过程见本线程上方审核回复。 |
What & why
node-forgeandundiciare devDependencies that tsup inlines into everydist/bundle vianoExternal(tsup.config.ts:61). The published artifact therefore ships these copies even though a consumer'snpm audit/ SCA scan can never see them — they're absent from the installed tree and exist only as bytes insidedist/*.js. That is what makes them "invisible to npm audit".The lockfile pinned vulnerable versions:
node-forge 1.4.0— 11 advisories (ASN.1 OID truncation, TLS client crash,pem.decodeReDoS,BigInteger.modInverseinfinite loop, trusted-CA removal, basicConstraints bypass, AES-GCM tag bypass, PKCS#12 MAC forgery, TLS record DoS ×2, RSA PKCS#1 v1.5 nested-DigestAlgorithm acceptance)undici 7.29.0— 18 advisories (orphaned-RetryHandler DoS, response-splitting retry interceptor, unrequested WS subprotocol DoS, unbounded decompression, cross-user cookie disclosure, response-truncation dump interceptor, TLS cert-validation bypass (BalancedPool), unsafe-method caching/replay, WSStream unclean-close DoS, WS permessage-deflate DoS, cache-poisoning redirect, TLS cert-validation bypass (Agent), TLS1.2 renegotiation DoS, WS auto-PONG DoS, decompress-interceptor DoS, content-encodings DoS, EventSource unbounded memory, SRI algorithm-case bypass)Change
Bump both devDependency floors to exclude the vulnerable versions and re-resolve the lockfile:
^1.4.0→^1.4.1^7.29.0→^7.30.1No
src/changes.dist/is not committed — CI rebuilds it at publish time, so the next release re-inlines the patched copies automatically. Raising the floor (not just the lockfile) also prevents any future fresh resolve from landing back on the vulnerable versions.Verification (local, targeted)
npm installre-resolved only these two packages; the lockfile diff is exactly their two entries plus the root spec mirror — no other churn.npm run buildgreen;npm run typecheckgreen._encodeDigestInfo(node-forge ≥1.4.1,lib/rsa.js) → present in all 12 node-forge bundleswritableNeedDrain(undici ≥7.30.1,receiver.js) → present in all 15 undici bundlesBehavior-change note
The only behavioral delta is that the patched node-forge/undici code is now bundled instead of the vulnerable builds. Both bumps stay within semver-compatible ranges (forge patch-level, undici minor+patch) with no bili-side API change. Reachability was already assessed as low in the issue (node-forge is used only by the local MITM CA; the affected undici WebSocket paths are reachable only via a user-configured upstream). CI's real-client e2e lanes exercise the live fetch/undici path as the regression safety net.
Closes #5730