feat(v3): 房间事件通道归属 source:"room" → user="Room"(不再冒充 Codex)#203
Open
raysonmeng wants to merge 1 commit into
Open
feat(v3): 房间事件通道归属 source:"room" → user="Room"(不再冒充 Codex)#203raysonmeng wants to merge 1 commit into
raysonmeng wants to merge 1 commit into
Conversation
房间事件经 daemon systemMessage 注入时硬编码 source:"codex",被 MCP 通道渲染成 user="Codex"——与本机受信 Codex 搭档同一身份标签,误导。改为独立 source:"room" → user="Room",使通道外层框定本身就标不可信(内层 UNTRUSTED 文本前缀保留,双重框定)。 - types.ts: MessageSource 加 "room"(纯通道归属,不参与 reply/forward 路径) - daemon.ts: systemMessage 加可选 source 参数(默认 "codex"),仅房间事件这一路 stamp "room";其它 system 消息(ready/waiting/turn_aborted/budget resume)不变 - claude-adapter.ts pushViaChannel: 按 message.source 分支 user/user_id/source_type (room→Room/room/room,其余维持 Codex);formatSource 加 room→"Room";fallback drain body 改用 formatSource(msg.source) 避免房间事件误标 "Codex:";MCP 工具说明 补 user="Room" = 房间外部不可信通报的契约段 - 不破坏 v1 单机流:Codex 搭档消息仍 source:"codex"/user="Codex"(已加回归测试) Make room events use a distinct source:"room" → user="Room" so the channel label itself frames them as untrusted external input, instead of borrowing the trusted local Codex partner's user="Codex". The inner UNTRUSTED text prefix is kept (double framing). systemMessage gains an optional source param (default "codex"); only the room-event path passes "room". pushViaChannel/formatSource/ fallback-drain branch on message.source; the v1 single-machine Claude↔Codex flow is unchanged (regression-tested). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012rhWKm1VUSnEVxmjpYwNfc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要 / Summary
房间事件不再冒充本机受信 Codex:经独立
source:"room"渲染成user="Room"(而非user="Codex"),让通道层框定本身就标「外部不可信」。修安全 review 抓出的 MEDIUM(channel 归属混淆)。变更 / Changes(commit
1b83214)types.ts:MessageSource+="room"daemon.ts:systemMessage加可选source参(默认"codex"),仅房间事件注入用"room"(其余十余处 system 消息字节不变)claude-adapter.ts:pushViaChannel按 source 分支user/user_id/source_type(room→Room/room/room);formatSourceroom→"Room";drainMessages批头按实际 sender 归属(codex-onlyfrom Codex不变 / room-onlyfrom Room/ mixedfrom Codex/Room);CLAUDE_INSTRUCTIONS+get_messagesdesc 补 room 不可信说明source守卫对"room"天然 fail-closed(强化防回环)测试 / Test plan
bun run check全绿(1856 pass);新增 message-delivery 测试覆盖 room/codex/mixed 三路 + v1 回归v1 单机流不破(实证)
Codex 消息仍
user="Codex";所有非房间systemMessage默认"codex";handleReply硬编码source:"claude"——无任何非房间消息会拿到"room"。🤖 Generated with Claude Code