Repository navigation
[PR] fix: DNS-poisoned upstream TLS failures — stop advising "trust that CA", add cert forensics and circuit coverage (#4403) - #4417
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.9718-pr.4417.082dd82This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr4417.tgz
npm install -g packageInstall instructions are refreshed on each push. |
b9c44bf to
97a3a8a
Compare
[bot] (ai: vllm-qwen/qwen3.8-27b) 独立审核完成:拉取分支逐文件通读全部 14 个改动 + 本地定向验证 + CI 证据核对。结论先行:代码本身达到合并标准;当前 CI 6 个红 shard 全部来自 master 自身的回归(已另立 #4498),与本 PR 无关。审核期间在 PR 分支上补了 2 个有标注的修复 commit(b9c44bf → c248bb7)。 动作清单
验证证据
八问
测试有效性:新套件是真测试——真实握手 e2e(隔离 XDG root + 自签 mintHostCert + listen(0))、P0-3 接线走真实 summary executor(死端口 ×3)、每个 gate 都断言正反两向(unknown 开熔断但不弹 banner / ETIMEDOUT 两边都不计 / 非 trust code 不触发探针),断言有牙,回归时抓得住。 判定:可合。PR 描述完整(行为变更表逐项披露、与 #4257 的协调说明准确——#4257 仍未合,P2-3 未重复实现),代码与测试达标。建议等 #4498 修复、master 转绿后合并;若提前合并,6 个红 shard 由 #4498 解释即可。我不执行合并操作:#4417 |
c248bb7 to
dc5dc17
Compare
(ai: vllm-qwen/qwen3.8-27b) 查重:重复 #4506 —— 本 PR 的 CI 红不是本 PR 改动引起的,是继承 master 自身的红(#4506,已 bisect 定位,修复 #4511 已于今日 09:59Z 合入 master)。 发生了什么:6 条 test 车道全红,但逐份比对日志后只有 两个不同的失败用例,且都在存储域: 怎么修的:没有动本 PR 任何代码,把分支 rebase 到修复后的 master( 八问:
标签:沿用既有 bug / opencode / p2 / pr / scope/wiring(本条目是 wiring 域 PR 镜像,恰好一个 scope;CI 红属 master 继承的瞬态,根因已在 #4506 单独跟踪,不另立条目)。 结论:rebase 完成并已推送,等新 head(dc5dc17)CI 跑完;预期转绿后可合并。若新 head 仍红,属另一问题,届时再报。 |
dc5dc17 to
285824f
Compare
Certificate-trust deaths got one unconditional remediation ("install the
scanner/vendor CA") regardless of who presented the certificate — under
active DNS hijacking that advised installing the attacker's CA.
- tlsTrustRemediation branches on evidence (fired code, hostname,
enterprise signal, probe-captured SAN): expired -> lapse/clock-skew
text with no CA advice; alt-name-invalid or SAN lacking the host ->
"do NOT install this CA" + verify resolution; enterprise signal
(local/private proxy or configured extra CA material) -> original
#3776 scanner text verbatim; default -> verify-DNS-first.
- New upstream-cert-probe module: fire-and-forget <=5s handshake on
direct-mode trust-code failures captures remote IP/subject/issuer/SAN/
fp256 into bili.log, the 502 upstreamFailure slice and the remediation
cross-check. 10-min per-host cache, max 4 concurrent, never through a
proxy.
- Circuit gate now counts unknown-kind failures (CIRCUIT_KINDS =
ALERT_KINDS union {unknown}); banner set unchanged.
- Alert/circuit accounting added to the previously silent final-failure
paths: acp-loop re-request, external summary dispatch, preflight
summary request stage (resolving responses clear, like the relay).
- network.caFile / NODE_EXTRA_CA_CERTS load logs each merged cert's
subject/issuer/fp256 (#4403 P2-1).
- Rename isFailFastUpstreamKind -> isTransparentReplayableKind (P2-2).
Behavior changes disclosed in the PR description.
…find) The probe-captured SAN comparison was exact-match, so a legitimate enterprise scanner re-signing an internal domain with a single wildcard cert (SAN *.corp.example for api.corp.example) fell into the mitm-suspect branch and got 'Do NOT install this CA' advice. Wildcards now cover exactly one leftmost label (apex and multi-label hosts still read as hijack). Review-driven refinement of the P0-1 evidence branching; behavior change disclosed in the PR thread.
285824f to
0516588
Compare
已完成 rebase 并 force-push,冲突全部解决。 1. 是什么问题:PR #4417 与 base 分支 master 冲突(merge state: dirty),需要 rebase 到 master 并解决全部冲突。 2. 什么原因导致的:PR 切出后 master 前进了 2348 个 commit,其中两处与 PR 撞车:
3. 影响范围与严重程度:纯 rebase / 冲突解决,无行为变更。PR 分支现在干净地坐在 master 之上(merge-base == master head),merge conflict 已消除。 4. 怎么修复的:
5. 是否有回归问题:无。重命名行为中性;7-kind 集合采用 master 的(丢弃 PR 的旧 5-kind 是正确的)。 6. 是否破坏缓存:不涉及(纯 rebase,未触碰缓存/重试/游标/去重逻辑)。 7. 是否改了设计方向:不涉及。 8. 是否引入了新的配置:不涉及。 状态:分支已 rebase 到 master 并 force-push(新 head |
Closes #4403
Problem
When the upstream TLS handshake dies with a trust code (self-signed, untrusted root, alt-name mismatch…), bili's remediation text — introduced by #3776 — unconditionally told the user to export the presented chain's CA into
NODE_EXTRA_CA_CERTS/network.caFile. That is correct for the common producer (Kaspersky-style HTTPS scanning, corporate MITM) but dangerous for the other live producer this issue documents: DNS poisoning / link injection presenting a forged or foreign certificate. There, the advice installs the attacker's CA. Three gaps compounded it:openssl s_client;unknown) transport deaths never counted toward the circuit gate (the gate reused the banner whitelist), so a poisoning-flapping host never stopped resending full context;Changes
tlsTrustRemediation(ctx)): expired → upstream-lapse/clock-skew text, no CA advice;ERR_TLS_CERT_ALTNAME_INVALID→ "signed by a trusted CA but its names exclude the host — do NOT install any new CA, verify resolution"; probe-captured SAN provably lacking the target host → "do NOT install THIS CA"; enterprise signal detected (proxy on loopback/private space, or extra CA material already configured) → the original [Bug][tls] Proxy upstream TLS broken by security-software HTTPS scanning (Kaspersky MITM): client sees only a generic 502 | 安全软件HTTPS扫描致代理上游TLS失败,客户端只见泛502 #3776 scanner text verbatim; otherwise verify-DNS-first wording (still names Kaspersky/scanning and the caFile fix, behind "Before installing ANY CA").src/upstream-cert-probe.ts): on a direct-mode trust-code failure bili performs one fire-and-forget ≤5s handshake (rejectUnauthorized:false) and caches per-host for 10 min (max 4 concurrent). Result — remote IP, subject, issuer, SAN, fp256 — lands in the log line, the free-text failure string (probeRemote=/certSubject=/certIssuer=/certSan=/certFp256=), the structured 502upstreamFailureslice (raw values), and feeds the SAN cross-check in (1). Never fires through a proxy (the tunnel presents its own cert) and never for non-trust codes.CIRCUIT_KINDS = ALERT_KINDS ∪ {unknown}): unknown now counts toward opening; banners stay on the strict whitelist ("better silent than a misleading red banner"); client-abort and post-connect upstream-timeout remain excluded from both.network.caFile/NODE_EXTRA_CA_CERTSnow logs each merged certificate's subject/issuer/fp256 (loud warn when nothing parseable was found).isFailFastUpstreamKind→isTransparentReplayableKind(identical kind set; the name said nothing about why they're retryable).Free-text forensic fields mask private hostnames (existing #255 discipline, same as the
url=field); the structured slice stays raw.Behavior changes (old → new)
CERT_HAS_EXPIREDhintisFailFastUpstreamKindisTransparentReplayableKindNo config surface changes: no new fields/env vars;
network.caFileandNODE_EXTRA_CA_CERTSkeep their semantics.Coordination
PR #4257 (#4254) touches the same hot files (upstream-alerts/fail/proxy, relay, server) and separately puts the failure
kindinto the 502errorfield — that part of #4403 (P2-3) is deliberately NOT duplicated here. If #4257 merges first this branch needs a mechanical rebase; the changes are additive on the samedetailobject.Tests
New hermetic regression suite
tests/issue4403-dns-poison-tls-forensics.test.ts(18 tests): classification pins, gate-only unknown accounting (opens circuit, no banner; ETIMEDOUT still excluded), all five hint branches, seeded + real-handshake forensic capture (isolated XDG root, minted leaf,listen(0)ports), end-to-end P0-3 wiring through the real summary executor, caFile identity logging. Affected suites rerun locally green (upstream-fail, issue3776, issue3148-upstream-circuit, upstream-alerts, external-summary-http, preflight-fail-fast, preflight-transport-recovery incl. the updated #1987 pin); typecheck + build clean. Full-suite verdict: CI.