Skip to content

feat(core): HumanGrant 人类授权登录(Rust 微服务 WIP) - #866

Closed
LIghtJUNction wants to merge 61 commits into
wip/rust-core-go-extensionsfrom
feature/humangrant-wip
Closed

LIghtJUNction wants to merge 61 commits into
wip/rust-core-go-extensionsfrom
feature/humangrant-wip

Conversation

@LIghtJUNction

@LIghtJUNction LIghtJUNction commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

开发主线交接(2026-10-12)

开发默认主线现为 wip/rust-core-go-extensions;旧单体 main 与 traditional 冻结于 3948a0a1ee1cefdd016a7aa45a11851545bb4b85。分支交接不是发布、部署或验收通过。原问题、源码基线、测试与未完成项保留;旧单体路径仅作历史证据,后续先在微服务源码重新确认并按职责移植,不回灌旧数据库/权限/资金实现。

主线/S11 跟踪:#895。Extore 商品同步:#894,未验收,禁止部署,尤其禁止合并/推送 Extore main。

本 PR 的候选实现和已有验证范围保持原样;不因主线交接自动合并或标记验收完成。

目标

在 wip/rust-core-go-extensions 增加 HumanGrant 0.1 初步接入。本 PR 的目标分支是微服务重构 WIP,不是 main。

变更

  • Rust Ed25519 签名检查、nonce 重放保护、PostgreSQL 授权请求/审核记录/授权与审计。
  • 人类通过现有 Rust 浏览器登录凭据独立确认授权;独立签发绑定 AI 公钥的一次性凭据;支持拒绝、撤销和到期检查。
  • 首批受限权限仅 lmm.profile.read/self,不允许经由普通模型、付费或管理 API 访问,避免扩大权限。
  • 原生 Markdown 状态页、个人授权管理、前端入口及设置开关。设置数据默认 true,管理员可以关闭,服务端负责强制拒绝。
  • 七种语言的 UI 文本。

尚未完成 / 不合并前需验证

  • 此处环境没有 Rust/Cargo 工具链,尚未编译或运行 Rust 集成测试。
  • 上游文档中的邮件邀请采用可选方式;此版缺少 SMTP/发送系统,接口明确返回 mail_unavailable,不冒充已送达。
  • 需运行 cargo fmt、clippy、test、数据库实际端到端测试,验证多个并发批准/撤销、CSRF、重放,以及 React typecheck、i18n 同步。
  • 现有业务 API 没有自动获得 HumanGrant 权限:当前仅能读取自己的公开资料。

参考协议:https://github.com/LIghtJUNction/humangrant/blob/main/skills/humangrant-integrate/SKILL.md

本 PR 必须先通过检查和安全审查,再合入 WIP;不得借此直接合并 #675 到 main。

@LIghtJUNction

Copy link
Copy Markdown
Member Author

本轮对照了本 PR bbc2499f84bbf7c7bfee5702569fba0c4315a32d 与 A10 #880(后者已追加客户端局部修复 d730d1e2b)。不另建重复 HumanGrant 实现。

真正的接线阻塞是两端合同不同,需要先冻结一份服务器拥有的合同:

  • A10 配置读取 /humangrant/config,明确要求 enabled/ready;Core 当前提供 /api/status 中的 enabled 字段,没有相同的配置回执。
  • A10 设置使用 /api/user/auth/humangrant/settings、同源人类 Cookie、X-HG-CSRF,读取要求 enabled/csrf;Core 当前使用 /api/humangrant/settings 和浏览器 Bearer,读写只返回 enabled。
  • 入口跳转 /humangrant 与 Core 的 /human 也需明确映射。

建议优先由 Core 接入规范要求的真实人类 Cookie + 会话绑定 CSRF,再冻结 config/settings/回执与 proxy 路由;A10 按同一合同适配。不用让前端复制控制台 Bearer 来掩盖差异,也不以健康就绪等同完整授权可用。

当前首批范围仍只允许 lmm.profile.read/self;签名、mock transport 和客户端单测不能代替真实审批、claim、当前权限/到期/撤销及关闭重开的联合验收。邮件保持明确 unavailable 即可,不冒充发送。

本轮没有向本 PR 写入第二套代码、没有启用路由或部署。#880 的新本机结果和 Bun/Node TCP 差异已单独记录,A02/A10/S11 状态仍未完成。

@LIghtJUNction

Copy link
Copy Markdown
Member Author

Superseded by current WIP architecture

Closing this old draft as superseded. The current wip/rust-core-go-extensions line already owns a separate native HumanGrant implementation under services/core/src/humangrant/, with current Core tests and Web settings/session contracts. The old branch's agent.rs/route shapes do not match the current server-owned contract, so merging this draft would introduce a second HumanGrant implementation rather than complete the current one.

The remaining current-contract work (mail-unavailable behavior, CSRF/origin, replay/expiry, browser/CLI coverage) should be developed against the current WIP paths in a new focused change. No production deployment is implied.

@LIghtJUNction
LIghtJUNction deleted the feature/humangrant-wip branch November 5, 2026 07:31
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.

1 participant