Skip to content

[PR] fix(security): bump bundled node-forge to ^1.4.1 and undici to ^7.30.1 - #5739

Open
ranxianglei wants to merge 3 commits into
masterfrom
2026-11-05_bump-node-forge-undici-deps
Open

ranxianglei wants to merge 3 commits into
masterfrom
2026-11-05_bump-node-forge-undici-deps

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

What & why

node-forge and undici are devDependencies that tsup inlines into every dist/ bundle via noExternal (tsup.config.ts:61). The published artifact therefore ships these copies even though a consumer's npm audit / SCA scan can never see them — they're absent from the installed tree and exist only as bytes inside dist/*.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.decode ReDoS, BigInteger.modInverse infinite 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:

package floor locked before locked after
node-forge ^1.4.0 → ^1.4.1 1.4.0 1.4.3
undici ^7.29.0 → ^7.30.1 7.29.0 7.30.2

No 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 install re-resolved only these two packages; the lockfile diff is exactly their two entries plus the root spec mirror — no other churn.
  • npm run build green; npm run typecheck green.
  • Post-fix markers now present in every bundle that carries each package (mirrors the issue's repro, which found both markers absent from the published 0.1.212 tarball):
    • _encodeDigestInfo (node-forge ≥1.4.1, lib/rsa.js) → present in all 12 node-forge bundles
    • writableNeedDrain (undici ≥7.30.1, receiver.js) → present in all 15 undici bundles

Behavior-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

ework-agent and others added 2 commits November 5, 2026 14:36
…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
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-05_bump-node-forge-undici-deps (4eb7156)

Latest build — install this exact version

npm install -g billion-context@0.0.8250-pr.5739.554e781

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Recent builds (commit → version)

commit version build
4eb7156 billion-context@0.0.8250-pr.5739.554e781 build
2695159 billion-context@0.0.8241-pr.5739.659d428 build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr5739.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title fix(security): bump bundled node-forge to ^1.4.1 and undici to ^7.30.1 [PR] fix(security): bump bundled node-forge to ^1.4.1 and undici to ^7.30.1 Nov 5, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(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 的 Closes #5730 引用与之一致。

标签: bug + scope/ci + p2(安全缺陷类;依赖提版属构建面;可达性低、能用但有明确问题 → p2)

这是已完成的 agent PR(正文带 ework-agent-pr 标记),不重做——拉分支核对代码 + 查 CI 状态,报结论。

核对进展(初步):

  • diff 恰好 2 文件 10 行:package.json devDependencies 地板 node-forge ^1.4.0→^1.4.1、undici ^7.29.0→^7.30.1;lockfile 重解析到 1.4.3 / 7.30.2,无其他 churn —— 与描述一致 ✓
  • 无 src/ 改动、未动 version 字段、单 commit、分支不落后 master(无需 rebase)✓
  • tsup.config.ts 的 noExternal 确实把这两个包内联进 dist;kernel/ 与 pi-subagents/ 无各自独立的这两个包 pin,根 lockfile 单点管控 ✓
  • 独立安装锁定版本验证补丁标记:node-forge 1.4.3 的 lib/rsa.js 含 _encodeDigestInfo(×3)、undici 7.30.2 的 receiver.js 等含 writableNeedDrain——均存在;负对照(旧版 1.4.0 / 7.29.0)均缺失 ✓

CI check 结果出来后给完整审核结论(八问)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

本次运行结论:PR 红 = 继承性 master 红,不是本 PR 的问题;ci-fixes 合并已在分支上,新 head 全部检查绿。

查重: 不涉及(CI 自动修复车道,非新立项;诊断依据 #4599 CI 总控已有登记,未重复开单)。

结构化八问:

  1. 是什么问题:PR [PR] fix(security): bump bundled node-forge to ^1.4.1 and undici to ^7.30.1 #5739(捆绑依赖升级 node-forge ^1.4.1 / undici ^7.30.1)的 10 个测试分片全红。拉取失败 job 日志逐行比对后确认:失败签名与 CI Control Center: Centralized CI Failure Handling & Status Sync (Comment all CI issues here; do not open new issues) | CI 总控: CI 失败集中处理与状态同步(所有 CI 问题在此评论, 勿开新 issue) #4599 登记的 master 红家族逐字一致(dsh BLOCKED-ref 钉死测试断言 true/false、[Bug] dsh 车道切模型 fork 出的 _sub: 会话不继承父会话 fold 块:上游上下文从 ~83K 瞬间膨胀到 794K、命中归 0、节省转负(0.1.187/0.1.188) #2817 persona-fold 8 !== 9、[Bug][dsh] Plugin lane performs a full re-parse and resends the entire body every round (81 MiB → hundreds of MB AST), w | [Bug][dsh] plugin 车道每轮全量解析重发 body(81 MiB→数百 MB AST)是 #5403 OOM 的生产者:用水位线断言替换逐条复核,服务端只解析新增尾段 #5418 watermark A/B null !== 2)——是继承性失败,不是依赖升级引入的。
  2. 什么原因导致的:master 自 commit 01fcc5d([PR] fix: unknown dsh one-shot sidecars steal the raw-key anchor and kill compression (context-explosion root cause) #5687 dsh single-shot sidecar 门)起自身就红:[PR] fix: unknown dsh one-shot sidecars steal the raw-key anchor and kill compression (context-explosion root cause) #5687 改变了 dsh 侧请求分流行为,五个 dsh 回归钉死测试的预期值过期。修复已由哨兵收敛在 ci-fixes 分支(tip 0470bec,master + 恰好一个纯测试对齐提交)。按 CI 协调政策(2026-10-24):master 红 → PR 分支 merge ci-fixes,禁止自行长时间排查继承红。
  3. 影响范围与严重程度:仅 CI 可见性(所有在途 PR 继承性红),无任何运行时影响。本 PR 本身只动 package.json 两行 devDependency 版本下限 + lockfile 解析(undici 7.30.2 / node-forge 1.4.3),src/ 零改动。
  4. 怎么修复的:git merge origin/ci-fixes --no-edit 进 PR 分支。执行时发现并行会话已先一步推送了同一合并(新 head 4eb7156;与我本地合并产物的树逐字节一致,git diff = 0 行),因此本会话零推送,改为独立验证兜底:本地完整 build(kernel + pi-subagents + tsup)后定向跑三个失败钉死文件 = 6/6 子测试通过(含 CI 挂掉的三个用例),npm run typecheck 干净,构建产物安全标记齐全(node-forge _encodeDigestInfo ×8 个 bundle,undici writableNeedDrain ×11 个 bundle)。
  5. 是否有回归问题:无。逐项过:①版本下限升级落在同 minor 内的补丁级(1.4.0→1.4.1 下限/锁 1.4.3;7.29.0→7.30.1 下限/锁 7.30.2),API 兼容,无 fail-fast 变吞错、无阈值/时序漂移;②merge 带入的 ci-fixes 提交是纯测试预期对齐(五个 dsh 钉死测试改到 DSH: If the first request of a session originates from a bypass call, compression for the entire session is permanently | DSH: If the first request of a session originates from a bypass call, compress for the entire session is permanently inv | DSH:会话首个… #5656 sidecar 残余后的新真值),不动任何运行时代码——按交付物第 4 条披露:这是有意的测试期望变更,旧值→新值的完整对照在 CI Control Center: Centralized CI Failure Handling & Status Sync (Comment all CI issues here; do not open new issues) | CI 总控: CI 失败集中处理与状态同步(所有 CI 问题在此评论, 勿开新 issue) #4599 各 floor 与 [PR] test(ci): converge master red — realign five dsh pins to the #5656 single-shot sidecar residual (#4599) #5718 描述中,属哨兵维护内容;③未触碰 src/update.ts、kernel/、wire 形状、config schema、消息 id 逻辑。
  6. 是否破坏缓存:不涉及(无缓存/重试/增量游标/去重键相关变更)。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:不涉及(无新 env/config/默认值)。

最终 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 ranxianglei left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(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 in package.json, 8 in package-lock.json, zero other churn. No version field touched, no src/, no kernel/.
  • Supply chain: lockfile integrity hashes match registry.npmjs.org byte-for-byte for node-forge@1.4.3 and undici@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; undici 7.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-forge only in src/ca.ts (local MITM CA); undici in src/fetch-util.ts, src/responses-ws.ts, src/upstream-proxy.ts. Both sit in tsup.config.ts:61 noExternal → inlined into dist/; dist/ is git-ignored, so the next release re-inlines the patched copies with no further action.
  • No second copy ships: kernel/ and pi-subagents/ lockfiles do not pin either package. The undici 8.5.0 entry in pi-subagents/package-lock.json is a transitive of @earendil-works/pi-coding-agent (dev-only; stubbed out of bili bundles per #2186, and pi-subagents/src never 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 (八问)

  1. 是什么问题: 发布的 dist/ 捆绑物里带着 node-forge 1.4.0 和 undici 7.29.0 —— 29 个 CVE,且因 devDep 内联机制对 npm audit / SCA 完全不可见。
  2. 什么原因导致的: lockfile 钉在修复前版本;esbuild noExternal 内联使这些副本只存在于 dist 字节里,消费方依赖树中不存在。
  3. 影响范围与严重程度: 每个安装副本都携带漏洞字节;#5730 评估外部可达性低(forge 仅本地 CA 用、受影响的 undici 路径需用户自配上游或 Responses WS),但按安全账本仍属必须修。
  4. 怎么修复的: 抬 devDependency 下限排除漏洞版本 + lockfile 重解析(1.4.0→1.4.3、7.29.0→7.30.2),零代码改动,下次发版自动重新内联。
  5. 是否有回归问题: 无。逐项过既有行为:CA/MITM 路径(tests/mitm.test.ts 绿)、fetch/dispatcher 路径(real-client e2e 车道全绿)、wire/配置/持久化零触碰;两个 bump 都在 semver 兼容范围内,无 bili 侧 API 变化。行为变更已按规范披露(旧值→新值:捆绑的库版本)。
  6. 是否破坏缓存: 不涉及——未触碰缓存/重试/游标/去重逻辑。
  7. 是否改了设计方向: 不涉及。
  8. 是否引入新配置: 无。

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.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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,无其他发现可顺手修。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

PR #5739 审核完成:通过,建议 owner 人工合并(涉安全面,§7.4 要求 human-only merge)

结构化八问:

  1. 是什么问题:dist/ 里内联打包的 node-forge 1.4.0 与 undici 7.29.0 共携带 29 个已知漏洞(forge 11 + undici 18);这两个包以 devDependency 身份被 tsup 内联进每个 bundle,消费方的 npm audit / SCA 扫描完全看不到——漏洞只存在于 dist/*.js 的字节里。
  2. 什么原因导致的:tsup noExternal 把 devDeps 内联进产物,发布件因此携带这两份库的拷贝;lockfile 钉在含漏洞版本上,且没有机制随 advisory 修复抬升 floor——打包行为把「对审计不可见的 devDep」变成了用户侧暴露面。
  3. 影响范围与严重程度:所有已安装实例都携带含漏洞字节(全客户端/全车道);实际可达性低——node-forge 仅用于本地 MITM CA 路径(src/ca.ts:3),undici 受影响面(WS subprotocol/解压/缓存等)仅在用户配置的上游或 WS 路径可达。严重度 = 潜在安全暴露,非可用性缺陷(p2)。
  4. 怎么修复的:抬 semver floor(^1.4.0→^1.4.1、^7.29.0→^7.30.1)+ 重解 lockfile(实际落 1.4.3 / 7.30.2)。抬 floor(而非只改 lockfile)防止未来 fresh resolve 退回漏洞版本;dist/ 未提交,下次发版自动重内联补丁字节;零 src 改动。
  5. 是否有回归问题:无。审过的既有行为:diff 仅触 package.json devDeps + lockfile(2 文件 / 10 行);semver 兼容范围内(forge patch 级、undici minor+patch),bili 侧 API 零变化;高危模式逐项过——无阈值/时序/输出格式漂移、无 fail-fast 变吞错。合并 ci-fixes 后全量 CI 绿(见下)。
  6. 是否破坏缓存:不涉及——不触碰缓存/重试/增量游标/去重键逻辑。
  7. 是否改了设计方向:无——纯依赖提版,架构/边界/数据流不变。
  8. 是否引入新配置:无。

独立核验(不只信 PR 描述):

  • diff 核对:恰好 2 文件 / 10 行,与 PR 正文表格一致(floor + lockfile 1.4.3/7.30.2 + root spec 镜像),无其他 churn、未动 version 字段、无 src/。
  • 打包机制核验:tsup.config.ts noExternal 确实内联这两包;kernel/ 与 pi-subagents/ 自身 lockfile 均不钉这两包(根 lockfile 单点控制);唯一嵌套 undici 副本在 pi-coding-agent 之下(dev 工具、不入 bundle);dist/ 跟踪文件数为 0(.gitignore:2)→「下次发版自动重建」成立。
  • marker 独立验证(本地分别装新旧版):node-forge 1.4.3 lib/rsa.js _encodeDigestInfo ×3,1.4.0 中为 0(负控成立);undici 7.30.2 在 websocket/receiver.js 新增 writableNeedDrain(7.29.0 该文件无)——marker 选择与负向对照都站得住。
  • 可达性抽查:node-forge 仅现于 src/ca.ts:3;undici 现于 upstream-proxy.ts:4 / responses-ws.ts:3 / fetch-util.ts:1,与原 issue Dependency security: dist/ bundles node-forge 1.4.0 and undici 7.29.0 (29 advisories, invisible to npm audit) #5730 的低可达性评估一致。

CI 过程(先红后绿):

行为变更披露(Deliverables #4):唯一行为差异 = bundle 内联的是补丁版而非漏洞版(PR 正文已披露;semver 兼容、无 API 变化)。无其他行为漂移。

合并判定:审核通过、可合。按 §7.4 安全相关项(node-forge = MITM CA 库)不可自动合并,请 @ranxianglei 手动合并:#5739 (当前 open、mergeable=true;mergeable_state=blocked 为分支保护人工门禁所致,非 CI 红)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[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 过程见本线程上方审核回复。

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working p2 scope/ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dependency security: dist/ bundles node-forge 1.4.0 and undici 7.29.0 (29 advisories, invisible to npm audit)

1 participant