Skip to content

[PR] fix: plaintext body dumps get a standing credentials-warning banner (#4482) - #4483

Closed
ranxianglei wants to merge 3 commits into
masterfrom
2026-10-24_dump-plaintext-banner
Closed

ranxianglei wants to merge 3 commits into
masterfrom
2026-10-24_dump-plaintext-banner

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

给所有明文 body dump 加上常驻凭据警告 banner——不做自动脱敏(byte-exact 取证价值保留)。Closes #4482。

改了什么

6 个明文 body dump 写盘点全部在文件首行加一行:
PLAINTEXT DUMP — full conversation body, may contain credentials; scrub before sharing
(DUMP_PLAINTEXT_BANNER,新模块 src/dump-banner.ts):

文件 写盘点 gate
raw/*-REQ.txt src/server/relay.ts ACP_DUMP_BODY
raw/*-INCOMING.txt src/server/handle.ts ACP_DUMP_BODY
dumps/req-*.json src/server/relay.ts ACP_DUMP_BODY + dumpReq
dumps/req-*-REREQUEST.json src/loop/core.ts ACP_DUMP_BODY
dumps/err-*.json src/error-dump.ts BILI_DUMP_4XX
dumps/summary-err-*.json src/error-dump.ts BILI_DUMP_4XX

消费方兼容(审核中发现的回归点):

  • bili acp-cache diff(parseDumpFile)显式剥掉已知的首行 banner → 旧格式(无 banner)文件解析结果逐字节不变;新旧文件混在同一目录也可用(有测试)。banner 文本被测试钉住不得含 ": "(head 行按 header 解析)。
  • tools/analyze-dumps.mjs 在 JSON.parse 前剥 banner;其本地字面量副本由测试对照 src/dump-banner.ts,防漂移。
  • CONFIGURATION.md en+zh:dumpBody/dumpReq/dump4xx 三行补同一句警告。

行为变更(有意,显式披露)

dump 文件格式变更:上表 6 类文件均新增首行 banner。仓库内消费方已同步更新;仓库外严格把 req-.json / err-.json 当纯 JSON 解析的脚本需要跳过首行。第 1 行之后的 body 字节不变(byte-diff 取证价值保留)。无配置面变更、无默认值变化(所有 gate 保持默认关)、缓存/重试/增量游标不受影响。

范围外:SSE raw 响应 dump(*-raw.sse,不同 gate、响应字节流——插 banner 会破坏流格式);body 自动 redaction(破坏 byte-diff,如需属 owner 设计面,issue 明确排除)。

测试

新增 tests/issue4482-dump-banner.test.ts:banner 文本钉死 + tool 字面量同步检查、stripDumpBanner 单测(LF/CRLF/无操作)、真实写盘 harness(INCOMING/REQ/JSON 均以 banner 开头且 body 字节完整)、runDiff 旧格式/新格式/混合目录分类等价性。error-dump / issue1993-preflight-400 / reasoning-echo-400 套件补 banner 断言。本地定向跑 53/53 通过(新文件 + 5 个相关套件),typecheck/build 干净;全量套件以 CI 为准。

@ranxianglei ranxianglei changed the title fix: plaintext body dumps get a standing credentials-warning banner (#4482) [PR] fix: plaintext body dumps get a standing credentials-warning banner (#4482) Oct 24, 2026
@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-24_dump-plaintext-banner (0609489)

Latest build — install this exact version

npm install -g billion-context@0.0.5392-pr.4483.9479b67

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
0609489 billion-context@0.0.5392-pr.4483.9479b67 build
b9ba79b billion-context@0.0.5391-pr.4483.1875da9 build
e354285 billion-context@0.0.5390-pr.4483.bd60d32 build
960a6e2 billion-context@0.0.5387-pr.4483.3e22df9 build

Download artifact

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

Install instructions are refreshed on each push.

…4482)

Opt-in body dumps (ACP_DUMP_BODY / diagnostics.dumpBody, REREQUEST dumps,
BILI_DUMP_4XX err/summary-err dumps) write the full plaintext conversation
body to disk and may carry real credentials (tool arguments, host-injected
content), yet nothing warned the user. #4397's reporter saw live credentials
in such dumps; sharing them into an issue leaks them publicly.

No automatic redaction — byte-exactness is the point of these dumps. Instead
every plaintext-body dump file now starts with one standing warning line
(PLAINTEXT DUMP ... scrub before sharing):

- raw/*-REQ.txt, raw/*-INCOMING.txt, dumps/req-*.json, req-*-REREQUEST.json
  and err-*.json / summary-err-*.json all get the banner (DUMP_PLAINTEXT_BANNER
  in src/dump-banner.ts).
- bili acp-cache diff strips the known leading banner line explicitly, so
  pre-banner (old-format) dumps keep parsing byte-identically — old and new
  files also mix fine in one dir (tested). The banner text must stay free of
  ": " (head lines parse as headers); pinned by test.
- tools/analyze-dumps.mjs strips the banner before JSON.parse; its local copy
  of the literal is checked against src/dump-banner.ts by test.
- CONFIGURATION.md en+zh warnings for dumpBody/dumpReq/dump4xx go through the
  gen-config-docs seed (website/config-reference/diagnostics.yaml), keeping
  the docs-sync drift guard green.

Behavior change (intended, disclosed per owner policy): dump file FORMAT
changes for all six writers — a one-line banner is prepended. Consumers that
strictly parsed dumps/req-*.json or err-*.json as pure JSON from outside this
repo will see a non-JSON first line; in-repo consumers are updated. Body bytes
after line one are untouched (byte-diff forensics preserved).

Tests: new tests/issue4482-dump-banner.test.ts (banner pinned + tool sync,
stripDumpBanner unit, real-writer harness asserting INCOMING/REQ/JSON banners
with intact bodies, runDiff old/new/mixed-dir equivalence) plus banner
assertions added to error-dump / issue1993 / reasoning-echo suites.
@ranxianglei
ranxianglei force-pushed the 2026-10-24_dump-plaintext-banner branch from 960a6e2 to e354285 Compare October 24, 2026 05:01
… body

It only ever writes the response status + masked headers (src/server/relay.ts). Corrected the file list so the gate contract comment matches the writers. (review nit, unrelated to #4482 content)
@ranxianglei ranxianglei added bug Something isn't working p2 scope/wiring labels Oct 24, 2026
…_FILES

Both files landed on master via af8e5dc (#4449) without LIVE_FILES
registration, so the run-ci-tests process-spawn tripwire fails every
shard of every PR branch (inherited red master, unrelated to this PR's
change). Neither binds a port: codex-mcp-shell coordinates its spawned
shell child via ENTRY_REPORT_FILE, codex-plugin-version-sync runs
execFileSync synchronously. Appended at list end (slot = index).
@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: zhipuai-lb/glm-5.3)

已并入合并列车 #4551(master 合并,merge commit 保留原作者署名)。本 PR 关单收尾;回滚点为 #4551 单提交 revert。

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/wiring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Opt-in raw dumps (ACP_DUMP_BODY) write conversation bodies to disk unmasked with no warning — real credentials landed on disk

1 participant