feat(v3): 跨机上手链路 — auth issue / login --token / room invite / join 远程放宽#206
Open
raysonmeng wants to merge 2 commits into
Open
feat(v3): 跨机上手链路 — auth issue / login --token / room invite / join 远程放宽#206raysonmeng wants to merge 2 commits into
raysonmeng wants to merge 2 commits into
Conversation
补齐审计抓出的跨机 onboarding 大洞(根因:边机 abg auth login 自签的 token 进不了 broker store → broker 验 token 用自己 store → 4401): - `abg auth issue --id --name`(在 broker 机跑):在 broker store registerIdentity + issueToken + **打印 token 带外发**,**不写本地 auth-token**(token 是给别人的) - `abg auth login --token <PSK>`(在边机跑):把 broker 签发的 token 装进 `<state>/auth-token`(0600),**不 register/issue**;空 token 拒 - `abg auth login --id --name`:legacy 本机自签(单机:同一 store 既签又验),保留不变 - `abg room invite <roomId> <id> [--name] [--broker-url]`(broker 机):issueToken + addMember + 打印对方该跑的一条龙(`abg auth login --token …` + `abg join …`);**caller 必须是成员**(复用 §11.2 isMember 授权门) - `abg join` 远程房间放宽:本地无此房不再硬失败,只映射 cwd→room;成员制交 broker 订阅时强制(**不授予成员资格**) - 连接卡 net-detect.ts:改用真实命令(引导用 room invite) - cli.ts 路由 auth issue + room invite + printHelp 安全:auth issue/invite 复用 isMember 授权门;join 放宽只映射 cwd、broker 才是权威;0700 目录 + 0600 token;空 token 拒。 bun run check 1860 pass。 feat(v3): cross-machine onboarding — auth issue / login --token / room invite / remote join Broker validates tokens against ITS store, so an edge self-signed token was never valid (4401). Adds broker-side token issuance + edge-side install + one-shot room invite + remote-join relax. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012rhWKm1VUSnEVxmjpYwNfc
物理隔离的两个 SqliteStore(机器A=broker+operator / 机器B=远程边机),驱动真实 CLI 原语 (inviteRoomMember 在 store A 签发+加成员 → installToken 边机装 token → joinRoom 远程只映射 cwd) + 真实边机入口 startRoomBridge,证明:唯一跨界的是 token 字符串,机器A publish 的完成事件 送达机器B;全程 store B 零房间/零成员、连 token 都解析不了(resolveToken→null),broker(store A) 是唯一权威。负向:边机本地自签 token(store C,不在 broker store A)被 broker 拒——复刻修复前根因。 2 个对抗式 opus reviewer 各自独立跑变异测试(连接前删 store A 里 bob 成员资格 / 换 store A 没签发的假 token → B 收 0 条),均判「诚实证明、非空过」、0 真实 issue。 test(v3): cross-machine onboarding multi-store E2E proof (T8) Two physically separate SqliteStore files driving the real CLI primitives + the real edge entry (startRoomBridge): only the token string crosses; machine B's store holds no room / no membership and cannot even resolve the token (resolveToken→null) — the broker (store A) is the sole authority. A completion published on machine A is delivered to machine B. Negative test reproduces the pre-fix root cause (an edge self-signed token, never issued by the broker's store A, is rejected at 4401). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012rhWKm1VUSnEVxmjpYwNfc
Owner
Author
|
✅ T8 跨机 onboarding 多独立 store E2E 真测已落地(commit 2869fdd,本 PR 内) PR 说明里「物理隔离多 store 的真·端到端证明作为下一步」现已补上:
|
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.
背景 / Why
审计暴露的跨机 onboarding 大洞:broker 用自己的 store(
StorePskIdentityProvider+getMembers)验 token 与成员,而边机abg auth login只在本机 store 自签——方向反了,边机 token 永远进不了 broker store →4401。两边 store 物理隔离、零桥接。The broker validates tokens & membership against its own store; an edge
abg auth loginself-signs only in the local store, so an edge token never authenticated against a remote broker (4401). This PR adds the missing cross-machine onboarding primitives.改了什么 / What
abg auth issue --id --name(在 broker 机跑):在 broker storeregisterIdentity+issueToken+ 打印 token 带外发,不写本地 auth-token(token 是给别人的)。abg auth login --token <PSK>(边机跑):把 broker 签发的 token 装进<state>/auth-token(0600),不 register/issue;空 token 拒(fail-closed,避免静默关认证)。abg auth login --id --name:legacy 本机自签(单机:同一 store 既签又验),保留不变。abg room invite <roomId> <id> [--name] [--broker-url](broker 机):issueToken+addMember+ 打印对方该跑的一条龙(export AGENTBRIDGE_BROKER_URL=…+abg auth login --token …+abg join …);caller 必须是成员(复用 §11.2isMember授权门);loopback 地址会告警提示换可路由地址。abg join远程房间放宽:本地无此房不再硬失败,只映射cwd→room(agentId:null, local:false);不授予成员资格,成员制交 broker 在订阅时强制。net-detect.ts:改用真实可跑命令(引导走room invite)。auth issue补 token 积累诚实提示(与 invite 一致);removeRoomMember补房间存在守卫(与addRoomMember对称)。安全边界 / Security
auth issue/invite复用isMember授权门;join放宽只映射 cwd,broker 才是远程权威(subscribe/publish/投递/离线/补投全部对 broker store 校验,边机本地状态不被采信)。not a room member,跨网无存在性 oracle。测试 / Tests
cli-auth/cli-room/net-detect全绿;新增 invite 一条龙输出断言、远程 join 不授成员断言、remove成员/房间守卫断言。bun run check:1863 pass / 0 fail,typecheck 干净,plugin-sync OK,版本对齐。诚实标注 / Honest scope
abg auth revoke+ at-rest 哈希)。🤖 Generated with Claude Code