feat(identity): 三层身份模型 + id/name 分离 + abg auth login (PR2)#189
Open
raysonmeng wants to merge 1 commit into
Open
feat(identity): 三层身份模型 + id/name 分离 + abg auth login (PR2)#189raysonmeng wants to merge 1 commit into
raysonmeng wants to merge 1 commit into
Conversation
按 spec §2.1–2.2 落地三层身份(person / logical agent / session),消费 PR1b 的 Store + IdentityProvider。id(邮箱/GitHub 名)= 全局唯一路由键(UNIQUE,同 id 复用=同一人多设备); displayName 仅展示、可重(两个 Bob 不混)。 - Store 扩 auth_tokens 表 + issueToken/resolveToken/listTokens(接口 + Sqlite/InMemory + Postgres-skeleton + 契约,§6.4 两实现都过)。 - IdentityService:registerIdentity(id trim/空拒绝/同 id 复用)/ registerAgent / recordSession / resolvePerson(agent 上卷 person)/ issueToken(签发绑定身份的 PSK token)。 - StorePskIdentityProvider:broker 真正用的 auth 驱动——authenticate = store.resolveToken → getIdentity,读 live store(构造后签发的 token 也能认证)。 - abg auth login CLI:注册身份 + 签发 PSK token + 0600 原子写 token 文件 + 持久化绑定供 broker 校验。 测试:新增 identity-service / store-psk-identity-provider(复用 IdentityProvider 契约)/ cli-auth;Store 契约 25。 typecheck 干净;全量除一个 pre-existing flaky 计时测试(DaemonClient sendReply,隔离 5/5 pass,PR2 未改)外全绿。 Cross-review:轮1 thorough 抓出并修复 HIGH 安全洞——collab.db(存 raw PSK token + 身份 PII) 被 bun:sqlite 默认 0644 世界可读 → 把 collab DB 目录锁 0700(照 codex-transport.ts,目录级隔离覆盖 wal/shm,比文件级 0600 更持久)+ 测试锁死 + .gitignore 加密钥卫生条目;轮2/轮3 lean 连续两轮 0 收敛。 Backlog:id 大小写规范化;StorePsk 错误信息回显 id;token hashing at rest(§11.3); pre-existing flaky DaemonClient.sendReply 计时测试(单独 fix)。跨机 token 分发=PR3 broker provisioning。 --- feat(identity): three-layer identity model + id/name separation + abg auth login (PR2) Land the three-layer identity model (person / logical agent / session, §2.1–2.2) consuming PR1b's Store + IdentityProvider. id (email/GitHub) is the UNIQUE routing key (same id reused across devices); displayName is display-only and may collide. Adds Store auth_tokens + IdentityService + StorePskIdentityProvider (the broker's real auth driver) + `abg auth login` (issues a PSK token, 0600 token file, persisted binding). Cross-review caught + fixed a HIGH: the collab DB (raw PSK tokens + PII) was world-readable 0644 → the DB directory is now locked to 0700. Converged after 1 thorough + 2 lean adversarial rounds. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
3 tasks
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
PR2:落地三层身份模型(person / logical agent / session,§2.1–2.2)+ id/name 分离 +
abg auth login,消费 PR1b 的 Store + IdentityProvider。改动 / Changes
auth_tokens表 +issueToken/resolveToken/listTokensIdentityServiceStorePskIdentityProviderabg auth loginCLI测试计划 / Test plan
bun run checkexit 0 → 1719 pass / 0 fail、typecheck 干净、bundle 同步、版本对齐Cross-review
collab.db(存 raw PSK token + 身份 PII)被 bun:sqlite 默认 0644 世界可读(Linux~/.local/state0755 → 任何本机用户可读走所有 token)。「与 control-token.ts 一致」的说法被实证为假(那是 0600 文件)。→ 把 collab DB 目录锁 0700(照codex-transport.ts模式,目录级隔离覆盖 wal/shm,比文件级 0600 持久)+ 2 条目录权限断言锁死 +.gitignore加 collab 密钥卫生条目。Backlog(RECOMMEND / 既有)
DaemonClient > sendReply resolves on successful result(隔离 5/5 pass,全量套件偶发,PR2 未改)——建议单独 fix PR。🤖 Generated with Claude Code