Repository navigation
[A02][Draft] 认证兼容:原子改密与会话轮换、OAuth 双因素防护 - #877
Merged
LIghtJUNction merged 11 commits intoOct 12, 2026
Merged
Conversation
This was referenced Oct 12, 2026
This was referenced Oct 12, 2026
Collaborator
Author
|
A10 消费端进展:#880 的 4 项错误映射测试在 Node 22.16.0 隔离环境通过;两个无关错误处理依赖被替代,因此这不是完整注册页面、HTTP 拦截器或真实后端测试。项目固定 Bun 的前端测试和与本 PR 的实际联合验证仍待执行。此回报只确认客户端处理了该明确错误码,不确认 A02/A10 已完成。 |
…generation logout
LIghtJUNction
added a commit
that referenced
this pull request
Oct 12, 2026
Ports scoped #877 identity work through e8e8af8, authored by LIghtJUNction. Denies OAuth MFA bypass and unsupported email registration; preserves native/browser lifetimes and rejects wrong-password refresh replay. Adds browser/native separation and refresh-race regressions. 42 targeted tests and Clippy passed on existing Rust 1.98 with independent synthetic PostgreSQL; pinned Rust 1.99 remains blocked.
LIghtJUNction
merged commit Oct 12, 2026
07a6cbf
into
wip/rust-core-go-extensions
0 of 2 checks passed
Collaborator
Author
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.
范围
继续更新同一 A02 PR,目标仍是
wip/rust-core-go-extensions,不是 main;未合并、未部署。完整 A02 尚未完成。已提交
369a4cce4b9ae0ff5324423343def0197ee9f53f修正此前 CI 的两份测试文件格式。e8c5f4a2be3c5bc0ebb2188426fbce85cb846693接通浏览器PUT /api/user/self密码修改:原密码验证、密码写入、用户凭据代际推进、当前会话的 access/refresh 轮换及审计在同一事务完成。失败回滚;其他旧会话和本人签发的旧 API Key 因代际不符失效,不触碰其他用户身份或资金。改密代码只增加 A02 的 browser/password 叶模块并修改现有 profile handler。没有修改共享 DDL、配置、Cargo、权限脚本、Web/CLI 或 Git 子模块指针。
A02 password-change v1 客户端合同
PUT /api/user/self;当前浏览器Authorization: Bearer ...;规范同源 Origin。可带X-Auth-Session,提供时必须与当前会话一致。original_password、password;可选display_name。新密码沿用浏览器 8–20 字符要求,密码不裁剪。未知字段、客户端指定 user_id、混合密码和偏好更新均拒绝。success/data包装,返回新的 access_token、token_type、access_expires_at、session 和 user;同一 sid;设置新的 HttpOnly/SameSite=Strict refresh cookie;正式 HTTPS 配置仍要求 Secure。响应不缓存。实际验证
64f75d5的真实 CI:432 通过、0 失败、3 跳过;格式失败。旧结果只作为旧输入证据。369a4cc的 MK-01 身份与团队检查 已全部成功。e8c5f4a的 MK-01 检查 与 微内核检查 已触发,结果尚在核验,暂不标通过。剩余 A02
完整双因素挑战/TOTP/恢复码、Passkey、邮箱验证与找回密码、其他 OAuth provider 与 OAuth2 授权服务器、HumanGrant Rust 持久授权/撤销、历史 API Key 导入及完整客户端联合验收仍未完成。真实浏览器、独立 CLI、真实外部 OAuth provider、生产环境均未作为本轮测试对象。S11 仍需最终组合验证;不能因本 PR 部分检查通过关闭完整 A02。
对照 main 改密来源:
3948a0a1ee1cefdd016a7aa45a11851545bb4b85的apps/api-go/controller/user.go::UpdateSelf及 WebUpdateUserRequest。没有将整条 main 或旧 Go 认证写入搬回 Rust 核心。本轮推送:原生会话改密(尚未通过新提交 CI)
在原有浏览器改密实现的基础上,补充 Rust Core 原生
POST /core/v1/auth/password。仅接受有效 native session、原密码与新密码;API Key、旧浏览器会话绑定及未知 JSON 字段不能借此取得新会话。密码写入、auth_version更新、新 session 签发、旧 session 撤销及审计均在同一数据库事务中提交;旧凭据列表显示版本失效。新增 8 项 SQLx 测试,覆盖合法请求、参数拒绝、旧会话及 Key 失效、并发只能完成一次、策略与密码哈希变更、锁冲突、审计回滚及旧 bcrypt 验证迁移。保留原有浏览器改密模块和已有 5 项相关测试,不覆盖它们。
新增提交:
061493f(Core 原生改密)、726534b(HTTP 路由)、e8e8af8(测试)。补丁的三个 Git blob SHA 已从远端核对。这是 Draft,新增代码未在本地编译或运行 PostgreSQL;不能复用上一版 CI 通过结果。参见 最新 CI。完整 A02 的第二因素、Passkey、OAuth2、HumanGrant 和独立 CLI 联合验收仍待后续完成。