feat(v3): 房间口令自助加入 — room --password + join --password(§11.2)#207
Open
raysonmeng wants to merge 1 commit into
Open
feat(v3): 房间口令自助加入 — room --password + join --password(§11.2)#207raysonmeng wants to merge 1 commit into
raysonmeng wants to merge 1 commit into
Conversation
…sword 让已认证(PSK token)的身份凭房间口令把自己加进房间,免成员逐人 abg room add(§11.2): - backbone/password.ts:scrypt 加盐哈希 + 常量时间校验,malformed 安全返回 false - Store:setRoomPassword/getRoomPasswordHash(sqlite 加 password_hash 列 + idempotent ALTER 迁移;memory;postgres stub) - broker.ts:新 `join` wire 消息——校验房间口令→addMember 授持久成员;**按身份跨连接限流**(5 错→锁 60s,键为 PSK 身份,重连不重置)+ **时序等化**(DUMMY_PW_HASH 让无房/仅邀请/错口令时延一致,防枚举)+ 缓存失效 + fail-closed(store 错不授权、不烧计数) - broker-client.ts:joinWithPassword(pending 按 topic 关联,断连/关闭兜底 reject) - cli/room.ts:room create --password / room set-password --password|--clear(成员限定)/ join --password;**--password-stdin** 避免 argv/shell-history 泄漏;空口令守卫;removeRoomMember 返回 roomHasPassword,remove 时告警「仅 remove 非有效撤销,需同时改/清口令」 安全:PSK + 口令双闸不可绕;口令仅 scrypt 哈希存、不落日志、store 外不可解析;按身份限流 + scrypt 成本界定在线爆破;offline 爆破不可能(hash 不出 broker)。 测试:password 4 + broker-password-join 9(对/错/无口令/限流/重连不重置/锁定过期恢复/空/未连/真 CLI 跨机自助加入)+ cli-room 新 5。bun run check 全绿。 cross-review:3 轮各 2 个独立 reviewer。轮1 安全审抓 3 真实 MEDIUM(连接级限流可重连复位 R1 / argv 口令泄漏 R2 / remove 非有效撤销 R3)→ 全修;轮2 双 0;polish 轮双 0 收敛。 feat(v3): room-password self-service join — `abg room create/set-password --password` + `abg join --password` An already-authenticated (PSK) identity can add itself to a room by presenting the room password, sparing a member from `abg room add` per person (§11.2). The password is scrypt-hashed at rest; the broker gates with PSK + password (two gates), throttles per IDENTITY (reconnect-proof), equalizes timing (no room-enumeration oracle), and fails closed. `--password-stdin` avoids argv/shell-history leak. 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.
背景 / Why
跨机 onboarding(#206)仍需成员在 broker 机上对每个新人跑
abg room invite/abg room add。本 PR 加房间口令自助加入(§11.2):房间设一个口令后,**已认证(持 broker 签发 PSK token)**的身份可凭口令把自己加进房间,免逐人 add。Cross-machine onboarding (#206) still needs a member to run
abg room invite/abg room addfor each newcomer. This PR adds room-password self-service join: with a room password set, an already-authenticated identity can add itself by presenting the password.改了什么 / What
abg room create <name> --password <pw>/--password-stdin:建房并设自助加入口令。abg room set-password <roomId> --password <pw>|--password-stdin|--clear:成员设/改/清口令。abg join <roomId> --password <pw>|--password-stdin:连 broker(PSK 认证)+ 交口令 → broker 校验 → 授持久成员资格 + 映射 cwd。scrypt$salt$hash加盐哈希存(backbone/password.ts),常量时间校验,malformed 安全返回 false。setRoomPassword/getRoomPasswordHash(sqlite 加列 + idempotentALTER迁移老库;memory;postgres stub)。joinwire 消息:校验→addMember→缓存失效;broker-clientjoinWithPassword(pending 按 topic 关联、断连兜底)。安全边界 / Security
authenticate)之后,无 token 发不了 join;口令是第二道闸。DUMMY_PW_HASH)+ 收敛到同一invalid room or password——无「哪些 slug 是带口令房」的枚举 oracle;broker 对「房不存在」与「非成员」subscribe 也回同一 reason。scrypt哈希存、不落日志、store 外不可解析;--password-stdin避免 argv(ps//proc)+ shell history 明文。room remove单独不是有效撤销(被移除者持 token + 知口令可自助加回)——remove 时打告警,提示同时set-password --clear/轮换。测试 / Tests
password.test.ts4 +broker-password-join.test.ts9(对/错/无口令/限流/重连不重置/锁定过期恢复/空/未连/真 CLI 跨机自助加入:broker store 授成员、edge store 仅映射 cwd)+cli-room.test.ts新 5。bun run check:全绿,typecheck 干净,plugin-sync OK。栈 / Stack
base =
feat/v3-xnet-onboarding(#206)。逻辑上叠在跨机 join 流程之上。🤖 Generated with Claude Code