Skip to content

fix(report): 为主编排回注补充 IPC 鉴权 - #779

Merged
deepcoldy merged 6 commits into
deepcoldy:masterfrom
wzono:fix/report-daemon-ipc-auth
Aug 12, 2026
Merged

deepcoldy merged 6 commits into
deepcoldy:masterfrom
wzono:fix/report-daemon-ipc-auth

Conversation

@wzono

@wzono wzono commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

背景

隔离 / 读隔离会话执行 botmux report 时不能读取 host IPC secret,也不能信任本地可写的 dispatch registry。这个 PR 的目标是把完成回报路由收口到 daemon 可信路径,避免隔离会话伪造 source / target 或跨会话覆盖主编排回注目标。

改动内容

  • 新增 daemon 侧 report relay:隔离会话通过当前 turn 的 managed-origin capability 调用 source daemon,由 daemon 校验 source session、dispatch root 与 turn provenance 后,再向目标主编排 daemon 投递受控 /api/trigger。
  • 新增 HMAC 签名的 reportBinding:回报目标只从宿主签名 payload 派生,不再信任 registry 里可变的 orchAppId / orchSessionId 字段。
  • 收紧 dispatch 注册信任模型:botmux dispatch 不再由 CLI 先发送 seed 后拿 dispatchRoot 注册;CLI 只提交 seedText 和元数据,source daemon 验证当前会话后自己发送 seed,并用返回的 message id 原子签发 binding、写入 registry。
  • 增加 registry 覆盖保护:在 withFileLock 临界区内允许相同 entry 幂等重写,拒绝同一 seed 被替换成不同 report target,避免跨会话重签 / 覆盖劫持。
  • 移除旧的 bot 级 seed 回查证明 dispatchSeedOwnedBy,避免把“本 bot 发过这个 seed”误当成“本会话拥有这个 seed”的安全依据。
  • 补齐隔离凭据发布与沙箱屏蔽:Linux bwrap / 全量 fs-policy 下屏蔽 report binding secret;macOS credential-only Seatbelt 保持既有 host HMAC 直连边界。
  • 保留 type-ahead / turn 绑定修复:thread 使用稳定 root,chat 使用当前 turn 的精确 reply target,跨 root / 跨 turn / 跨会话 fail closed。

安全边界

  • reportBinding 的 target 由 daemon 生成并签名,隔离 CLI 只能携带未信任 report 内容,不能选择目标 app / session。
  • 新 dispatch seed 的 message id 由 daemon 发送后当场产生,调用方不能拿其它会话的既有 seed 冒名注册。
  • 若 daemon 发送 seed 成功但 registry 落盘失败,可能留下一个无人继续派活的孤儿 seed;CLI 收到非 2xx 会停止,不会发送 repo prime / kickoff,因此这是可用性残留,不会产生可劫持的 report 路由。
  • macOS credential-only Seatbelt 仍属于既有信任边界:主 .dashboard-secret 可读,因此 report 按设计走 host HMAC 直连;若后续要把该模式也视为不可信 IPC,需要同时屏蔽主 secret 和 binding secret,再强制走 relay。

影响面

  • 影响 botmux dispatch --bot-app 新建子项目话题时的 seed 创建与 report binding 注册。
  • 影响隔离 / 读隔离会话内 botmux report --dispatch-root ... 的 daemon relay 路由。
  • 涉及公共 daemon IPC、dispatch registry、sandbox/read-isolation 凭据发布,以及 tmux / tmux-pipe / zellij / zmx 后端的 managed-origin env 注入。
  • 不改变普通 botmux send、botmux report --legacy-dispatch、issue binding report、以及非隔离会话的普通消息发送语义。

验证

在最终 head dfc564f61 上复核:

  • pnpm build:通过(domain audit / tsc / runtime build id / dashboard bundle / dist audit)。
  • 聚焦相关测试(dispatch-registry 并发 + 异 target 拒绝 + 幂等写、dispatch-report-binding、report-session-relay、report-daemon-ipc-auth-wiring、managed-origin-capability、read-isolation、sandbox、v3-session-relay-client、tmux-backend-env 四持久后端 env 注入、daemon-ipc-session-auth):全部通过。
  • git diff --check:通过;worktree clean。
  • 覆盖攻击复现:篡改 registry entry 的 orchAppId / orchSessionId 后 binding 验签失败(dispatch_binding_unproven);同 seed 异 target 重签被 registry 覆盖保护拒绝且原文件不变。

已知非本次阻塞

  • 本地完整 pnpm test 仍有与本次改动路径无关的环境 / 长耗时红项:IPv6 localhost family、Pi reaction status 顺序、Codex App runner / worker timeout。
  • 并行跑 pnpm build 时曾导致依赖 dist/cli.js 的测试临时失败;在 build 完成后单独复跑相关用例已恢复通过。

@wzono
wzono requested a review from deepcoldy as a code owner August 7, 2026 06:51

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f7e7320290

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/cli.ts Outdated
let response: Response;
try {
response = await fetch(`http://127.0.0.1:${daemon.ipcPort}/api/trigger`, {
response = await fetchDaemonIpc(daemon.ipcPort, '/api/trigger', {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Route credential-isolated reports through a trusted relay

On Linux hosts with device credential isolation enabled but the per-bot file sandbox disabled, the credential-only bwrap wrapper deliberately masks .dashboard-secret while leaving the dispatch registry and daemon descriptors readable. This branch is therefore reachable, but fetchDaemonIpc calls loadDaemonIpcSecret() before sending anything and throws, so every registry-backed botmux report still fails instead of reaching the orchestrator. Use a daemon-side relay or a session-scoped capability path rather than requiring the agent process to read the host HMAC secret.

AGENTS.md reference: AGENTS.md:L54-L58

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

已修复。credential-isolated CLI 不再读取 host HMAC:它改为携带当前轮换的 session capability 请求 source daemon 的 /api/report-relay。该 handler 会绑定 live session / turn / dispatch root,从宿主 registry 派生目标身份,并由 daemon 使用 HMAC 转发固定的 untrusted report envelope;调用方提交的 source/target 字段不会被信任。补充的授权与 wiring 回归覆盖了缺失、错误、过期 capability,跨 root/turn、身份夹带、receiver 拒绝和 256 KiB body limit;相关 323/323 测试及 pnpm build 均通过。修复提交:37b64f8a。

@wzono

wzono commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 37b64f8a1f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/cli.ts Outdated
Comment on lines +8983 to +8987
const originClaim = readManagedOriginCapability(
resolveDataDir(),
sid,
relayDir,
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Publish a capability for credential-only isolation

When device credential isolation is enabled but the full file sandbox is disabled, this fallback still cannot authenticate: BOTMUX_SEND_RELAY is unset, while the worker creates neither a Linux relay-outbox capability nor a read-isolation/origin-*.json file for credential-only bwrap, so originClaim is null and /api/report-relay rejects the request with origin_unproven. Fresh evidence after the prior thread is that the new client now reads this capability, but the credential-only worker path was not updated to publish it; therefore the scenario this commit intends to fix still breaks every registry-backed report. Publish a child-readable rotating capability for the credential-only path or provide another session-scoped transport.

AGENTS.md reference: AGENTS.md:L54-L58

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

已补齐 capability 生产端。credential-only worker 现在为每个 session 创建私有轮换目录,bwrap 先用 tmpfs 屏蔽整个 read-isolation 父目录,再只读绑定当前 session 子目录;因此 sibling capability 不可见,同时目录 bind 能观察 atomic rename 后的新 token。worker 在 fresh spawn 与 safe reattach 都会发布当前 session/turn capability,并通过 BOTMUX_ORIGIN_CAPABILITY_DIR 指向该目录;pane marker 升至 v10,使缺少新 mount/env 的旧 pane 强制冷启动。真实 bwrap 验证覆盖了 token v1→v2 轮换可见与 sibling 隐藏,相关 389/389 测试及 pnpm build 通过。修复提交:0f656a86。

@wzono

wzono commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0f656a86ce

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/worker.ts Outdated
}
if (!willReattachPersistent && credentialOnlyBwrap) {
let credentialOnlyCapabilityDir: string | undefined;
if (credentialOnlyBwrap) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Provision the relay capability for credential-only Seatbelt

On macOS when device credential isolation is active but the full file sandbox is disabled, the credential-only Seatbelt profile masks the host HMAC secret, but this new capability publication is guarded exclusively by credentialOnlyBwrap. The existing macOS capability setup is inside if (sandboxRequested), so this combination has neither the secret nor its own published claim; botmux report consequently submits no originCapability and /api/report-relay rejects every registry-backed report with origin_unproven. Add an equivalent current-session capability transport and carve-out to the credential-only Seatbelt path.

AGENTS.md reference: AGENTS.md:L54-L56

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

已补齐 macOS credential-only Seatbelt。worker 现在对 Seatbelt 与 bwrap 共用同一套 per-session capability 发布与 BOTMUX_ORIGIN_CAPABILITY_DIR 注入;Seatbelt profile 先 deny 整个 read-isolation 父目录,只授予父目录 metadata traversal 和当前 session 子目录 read,并在后序规则继续 deny 父目录 write,因此 sibling capability 不可读、当前轮换文件可读且不可写。pane marker 升至 v11,缺少新 profile/env 的 v10 Seatbelt pane 会冷启动。TDD 用例先复现缺失路径,相关 390/390 测试及 pnpm build 通过。修复提交:88169d58。

@wzono

wzono commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 88169d58f8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/core/report-session-relay.ts Outdated
Comment on lines +91 to +98
const rawEntry = input.registry[dispatchRoot];
const entry = rawEntry && typeof rawEntry === 'object' && !Array.isArray(rawEntry)
? rawEntry as Record<string, unknown>
: undefined;
const targetLarkAppId = typeof entry?.orchAppId === 'string' ? entry.orchAppId.trim() : '';
const targetSessionId = typeof entry?.orchSessionId === 'string'
? entry.orchSessionId.trim()
: '';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Protect relay targets from a writable dispatch registry

When device credential isolation is enabled without the full file sandbox, both credential-only wrappers still permit writes to orchestrate-dispatch.json (bwrap binds / read-write, while the Seatbelt profile only protects credential/profile paths). An isolated CLI can therefore copy any other live orchAppId/orchSessionId tuple from the readable registry into its own capability-bound dispatch-root entry, then call this relay; these lines treat that caller-modified entry as trusted and send an HMAC-authenticated trigger into the victim session. Bind the target to host-owned immutable provenance, authenticate registry entries, or make this registry host-write-only before using it as an authorization source.

AGENTS.md reference: AGENTS.md:L54-L58

Useful? React with 👍 / 👎.

@deepcoldy

Copy link
Copy Markdown
Owner

Review: 有 blocking 问题,暂不可合

在 head 88169d58f 上复核了这版实现(pnpm build 通过、聚焦相关测试通过),确认 2 个 P1 + 1 个 P2,均可稳定复现。当前不建议合并。


P1|新 capability 目录穿不过默认 tmux 后端 → Linux 隔离 report 必 403

worker.ts 只把 BOTMUX_ORIGIN_CAPABILITY_DIR 写进过滤前的 childEnv,但 tmux / tmux-pipe / zellij / zmx 这些持久化后端最终只透传 BOTMUX_INJECTED_ENV_KEYS(src/utils/child-env.ts)里的 key,而这个新 key 没被加进该白名单。

  • 默认后端就是 tmux(config.ts 无条件默认 tmux,PTY 需 BACKEND_TYPE=pty 显式 opt-in),所以命中的是默认配置,不是边角。
  • key 被丢后不是优雅降级,而是硬失败:worker 发布到目录式路径 …/read-isolation/origin-<digest>/.botmux-origin-capability.json,而 CLI 拿不到该 env 时回退去读旧的单文件 …/read-isolation/origin-<digest>.json——两条路径不同 → 读到 null → /api/report-relay 缺 capability → 403 origin_unproven。
  • worker.ts 的 ready 预检 hasMatchingManagedOriginCapability(...) 读的是过滤前的 childEnv(worker 自己进程内),会误判 ready transport 可用,从而掩盖运行期断裂;SessionStart / v3 relay 等共用路径同样受影响。
  • 对照 BOTMUX_TURN_ID / BOTMUX_DISPATCH_ATTEMPT:它们用同样的 childEnv.XXX = ... 赋值方式,但在白名单里,所以能到达 pane。

建议:把该 key 纳入 BOTMUX_INJECTED_ENV_KEYS(连带 tmuxEnv strip / server-global scrub 自动跟随,防陈旧值泄漏到非隔离 pane,语义同 BOTMUX_READ_ISOLATION),并补 buildBotmuxEnvAssignments 回归。至少在默认 tmux 后端 + Linux credential-only 会话上真实验证 capability 能透传进 pane——不能只测 worker 内视图(那正是本次假绿的来源)。


P1|目标派生不是真正"服务端可信派生",registry 可被隔离 CLI 改写(confused deputy)

credential-only bwrap 的底座是 --bind / /,除凭据文件外宿主文件仍可写;orchestrate-dispatch.json 不在掩码集里,隔离 CLI 可写它。daemon 侧(daemon.ts)读取这份 CLI 可写文件,report-session-relay.ts 随即把其中的 orchAppId / orchSessionId 当作可信 target。

授权函数只把 dispatchRoot 这个 key 绑定到调用方自己的会话(live turn / quoteTargetId / rootMessageId 校验的是"这个 root 是不是我的"),但没有校验该 key 下 entry 值的完整性,而该值恰恰来自可写文件。

复现:隔离 CLI 合法拥有自己的 root om_self,把 registry["om_self"] 改成任意 victim 的 {orchAppId, orchSessionId} → 带自己的 live capability POST /api/report-relay → capability ✓ + turn ✓ + rootMessageId === om_self ✓ → 授权返回 ok: true,target = victim → daemon 用 HMAC 签名的 /api/trigger 打到 victim 会话。

需要修正"忽略 body 自带 target 即安全"的假设:忽略 body 只挡住了一个入口,真正的 target 来源(registry entry 值)仍可被调用方篡改。trusted: false 只标记正文,消不掉跨会话触发、成本消耗与 prompt injection。

建议:target 绑定必须来自 daemon-owned 的不可变 provenance,或宿主签名的 registry entry,或等价的不可由 CLI 改写的授权状态;仅"忽略 body 自带 target"不够。


P1(可达性)|隔离分支在 relay 前仍依赖 CLI 本地 registry lookup

两条 relay 分支(直连签名 + 隔离 relay)都嵌在同一个 if (!hasExplicitPlacement && entry?.orchAppId && entry?.orchSessionId) 里,而 entry 来自 CLI 自己对 orchestrate-dispatch.json 的读取。

  • 全量 fs-policy 沙盒 / macOS 完整读隔离下,registry 不在 allow 列表 → CLI 读到 {} → entry 为空 → relay 块整个进不去 → report 静默 fallback 到普通 recipient 投递,永远到不了主编排。而这两种模式恰好也是屏蔽了 .dashboard-secret、最需要 relay 的场景。
  • 显式 --dispatch-root + registry 被 mask → CLI 直接 exit(1)。

结果:当前 relay 分支实际只在 credential-only bwrap(registry 可见)那一档可达,而那一档正好被上面两个 P1 咬住。注意:把 registry 判定挪到 daemon 侧修可达性时,不会自动修上面的完整性问题——daemon 读的就是同一份 CLI 可写的真实文件。可达性与完整性需要一起解决,否则等于把"够不着"变成"够得着但可被劫持"。

建议:隔离分支应凭显式 root + session capability 更早进入 source-daemon relay,由 daemon 做 registry 判定;同时该 registry 判定所依赖的 entry 必须是 CLI 不可改写的。


P2|type-ahead 会把合法 live turn 误判为 stale

ds.managedTurnOrigin.turnId(live origin)来自 worker 的正在执行的那一轮(按轮铸造 capability),而 ds.session.quoteTargetId 会被每一条新入站消息无条件覆盖(daemon.ts)。

当用户在子任务执行途中补一条消息,当前 capability 对执行轮仍然合法,但授权要求 quoteTargetId === liveTurnId(chat scope 还只看会被覆盖的 currentReplyTarget)→ thread / chat 两种场景都会返回 403 turn_provenance_stale。

建议:thread scope 只需把当前 capability 绑到稳定的 session root;chat scope 应查 exact per-turn 的 replyTargets[liveTurnId](reply-target.ts 已保留该 per-turn 权威槽),仅在单槽明确标注同一 turn 时兼容回退。现有"quoteTarget 变了就 stale"的用例应改成 type-ahead 正例。


两个非阻塞

  • macOS credential-only Seatbelt 当前并未屏蔽 .dashboard-secret(buildCredentialIsolationRules 的 deny 集只含 device-auth + marker),所以 macOS 上 report 实际走的是带 HMAC 的直连分支;新增的 Seatbelt capability carve-out 主要服务 session-ready / v3 relay 等路径。功能自洽,但 PR 描述"Linux bwrap 与 macOS Seatbelt 都为 report relay 发布 capability"与实际路径有出入,建议描述更精确。
  • report-session-relay.ts 里 _input / _decision / _meta 实际都被使用,下划线前缀通常表示"未使用",语义相反,可顺手清理(不影响结论)。

@wzono

wzono commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor Author

已在 4a6ea6ce 更新:提交信息已按仓库规范调整为 fix(report): 修复隔离会话回注鉴权与路由,同时合并当前 origin/master(31a71268)并解决全部冲突。

blocking 修复:

  • managed-origin channel 现在可透传到默认 tmux 等持久后端;credential-only Seatbelt/bwrap 只暴露当前会话的可轮换 capability 目录。
  • CLI 不再读取或信任可写 registry 的目标字段。daemon 在证明飞书 seed 确由当前编排 bot 发出后签发 HMAC binding;report 只使用验签后的目标,因此篡改 registry 不能劫持到其他会话。
  • registry 在隔离环境中不可见时,report 仍可经 source daemon 完成 lookup 与 relay;显式 --dispatch-root 同样可达。
  • thread 不再依赖可变的 quoteTargetId;chat 使用 replyTargets[liveTurnId] 精确槽位,允许 type-ahead,同时旧轮 capability 继续被拒绝。

验证结果:11 个相关测试文件共 255/255 通过;pnpm build 通过(domain audit、TypeScript、dashboard bundle、dist audit)。本机 Node 18 低于仓库当前要求的 Node >=22,因此全量矩阵以 CI 为准。

合并 origin/master(31a71268)并解决冲突。

为持久后端透传 managed-origin channel;由 daemon 签发并校验 dispatch binding,避免 registry 目标篡改;按 live turn reply target 处理 type-ahead。
@wzono
wzono force-pushed the fix/report-daemon-ipc-auth branch from 70f772c to 4a6ea6c Compare August 10, 2026 07:44
@deepcoldy

Copy link
Copy Markdown
Owner

复审新提交(head 4a6ea6ce5):修好了原 3 条,但新增 1 条 P1,暂不可合

新提交把原来的 env-指针 + CLI 读 registry 换成了 channel + 宿主签名 binding 的重设计。原来的 3 条 blocking(env 白名单、confused-deputy、可达性)与 P2 都已修好,验证如下;但新的 registration 流程引入了一条新的 P1。

✅ 原问题已修复(已逐条核对)

  • env 透传:BOTMUX_ORIGIN_CHANNEL_ID 已加入 src/utils/child-env.ts 的 BOTMUX_INJECTED_ENV_KEYS,并补了 test/tmux-backend-env.test.ts 断言它透传进持久后端 pane。publish/read 路径统一到 managedOriginCapabilityPath(dataDir, sid, channelId)。
  • 目标可信派生:src/core/dispatch-report-binding.ts 给 registry entry 加了 HMAC 签名 reportBinding,relay 只认验签通过的 target;签名 secret(.dashboard-secret.report-binding 前缀)对隔离 CLI 屏蔽。
  • 可达性:CLI 侧不再读 orchestrate-dispatch.json,改由 daemon 判定,全量沙盒/读隔离下不再够不着。
  • type-ahead:thread 只校验 rootMessageId === dispatchRoot;chat 用 exact per-turn replyTargets[liveTurnId],附了 type-ahead 正例测试。

🔴 P1|/api/report-relay/register 可被同 bot 的其他会话覆盖,劫持回报目标

register 在签发 binding 时,把 target 硬编码为发起注册的会话(daemon.ts 附近:targetSessionId: ds.session.sessionId,ds 来自 body.sessionId)。它调用 dispatchSeedOwnedBy 来防伪,但该函数只接收 larkAppId / botOpenId + targetChatId + message_id,没有 session 维度——它只证明「这条 seed 是这个 bot 发的」,不是「由发起注册的这个会话发的」。同一 daemon 服务同一个 bot 的多个话题会话,所以任意同 bot 的会话都能通过。加上 recordDispatchRegistryEntry 是无条件覆盖(registry[seedId] = entry,无「已存在有效 binding 就拒」的守卫),得到:

复现:同 bot 的会话 B,知道另一条合法 dispatch seed 的 message_id om_victim(同群里可见),POST register {sessionId: B, dispatchRoot: om_victim} → daemon 验「om_victim 是本 bot 发的」通过 → 签出 {om_victim → 会话 B} 覆盖原 binding。真实子任务向 om_victim 回报时,relay HMAC 验签通过(签名合法,只是 target 已被换),回报被转进会话 B。

HMAC 签名封住了「直接篡改 registry 文件」,但没封住「让 daemon 走合法流程替你签一个指向自己的 binding」——信任根从「文件不可写」搬到了「register 的授权」,而后者缺了 seed↔session 绑定 + 覆盖保护。

修法(需一起做,且需要真正的 outbound 归属机制):

  • 仅靠 dispatchRoot === session.rootMessageId 不行:seed 是新发的顶层消息(可能在 --chat-id 指定的另一个群),永远不等于会话自身 root;且现有 replyTargets 只记录入站 turn,没有本会话发出的 seed 的台账。
  • 首选:由 daemon 自己发送 seed 并原子写入 binding(发送方即签发方,无竞态)。
  • 次选:register 前先建一次性 dispatch-intent 绑定 (sessionId, targetChatId, liveTurn),register 时由同一会话原子消费。
  • 「已存在有效 binding 时拒绝异 target 覆盖」可封事后劫持,但单独做仍留首次注册竞态,只能作为必要补充。

nit(非阻塞)

将新 dispatch seed 的创建与 report binding 写入收口到 daemon 受信路径,避免 CLI 用既有消息 id 注册跨会话 target。

同时拒绝同一 dispatch seed 被替换成不同 registry entry,保留相同 entry 的幂等重写,并移除已不再使用的 bot 级 seed 归属证明。

Co-authored-by: TRAE CLI <[email protected]>
@deepcoldy
deepcoldy merged commit 7247b53 into deepcoldy:master Aug 12, 2026
LucasIcarus added a commit to LucasIcarus/botmux that referenced this pull request Aug 12, 2026
rebase onto 最新 master(含 deepcoldy#779 report IPC 鉴权)后,worker-pool
managed_turn_origin 处理块的 darwin-only 守卫被上游放宽为全平台,
两处 fail-closed 重置写点的归一化 AST 指纹随之漂移。写点本身的
语义、数量与分类(ephemeral_runtime / actor-host-runtime)均未变,
本提交仅重新入册指纹并重钉 coverage 台账的 inventory 摘要与
remaining-bypass 站点摘要(674 站点 / 677 变异计数不变)。

Claude-Session: https://claude.ai/code/session_01AjYRKcQeHGHFxWjKjRJsP6
LucasIcarus added a commit that referenced this pull request Aug 12, 2026
rebase onto 最新 master(含 #779 report IPC 鉴权)后,worker-pool
managed_turn_origin 处理块的 darwin-only 守卫被上游放宽为全平台,
两处 fail-closed 重置写点的归一化 AST 指纹随之漂移。写点本身的
语义、数量与分类(ephemeral_runtime / actor-host-runtime)均未变,
本提交仅重新入册指纹并重钉 coverage 台账的 inventory 摘要与
remaining-bypass 站点摘要(674 站点 / 677 变异计数不变)。

Claude-Session: https://claude.ai/code/session_01AjYRKcQeHGHFxWjKjRJsP6
@github-actions

Copy link
Copy Markdown

🚀 Released in v3.14.0

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants