Repository navigation
feat: 认证能力框架(CAP_AUTH)——OAuth 插件化 + 上游预设与模型检测 - #5
Open
mustardwheat wants to merge 9 commits into
Open
mustardwheat wants to merge 9 commits into
mustardwheat wants to merge 9 commits into
Conversation
…既有 EncKey/AesGcmKey 加密链路与 encryption_metadata 迁移
…SPRNG)/mb.oauth 回环回调监听/mb.open_external(限 http(s))/mb.fs.read(MB.fs_read_allow 白名单)/mb.time + HostBridge 默认拒绝扩展 + call_mb 多参旁路 + auth_plugin_for(只看 provider 显式绑定,全局开关对 auth 无效)
…重发 + 宿主原语落地(secret/random/回调监听/open_external/fs_read)+ 插件子请求不跟随重定向 + dispatch 认证头注入与 401 重试;顺带修复 Windows 上 script_ref 测试断言(UNC 前缀不兼容)
…(Kimi 设备码/刷新/身份头;Command Code 本地导入/回调/粘贴 + ctx.source 显式来源选择,whoami 失败显式暴露);三流端到端测试 7 项(mock HTTP)
…provider_detect_models(live 探测 + models.dev enrich/回退)+ 目录 TTL 缓存单飞与手动强制刷新 + 导入「有值者胜」合并与如实计数;oauth_describe/begin/status/cancel/paste 全平台无关编排(ctx.source 透传来源选择);令牌包加密存 secrets 表、provider 仅记非敏感 extra.auth;内置插件 include_str! 种子(幂等)
…链接),账户组经 describe 元数据驱动登录(来源选择/设备码/验证页/粘贴兜底,轮询带显式错误与取消路径);操作栏模型检测勾选导入(toast 如实计数);api.ts 补 oauthApi/预设/检测类型与目录新 DTO
…d)+ 认证能力框架入 architecture.md 与 moonbridge.lua LSP 桩;顺带修两处 Windows 存量测试不兼容(trace.rs 绝对路径拒绝的状态码语义、lifecycle.rs 子进程 env_clear 缺 SystemRoot 致 Winsock 10106)
… 设备授权直打真实端点;顺带把 commands/config/presets/state 模块与 run_begin 开放为 pub 供集成测试复用
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.
概述
在 #4 的整改意见(「OAuth 抽成插件能力」)基础上,于**最新 master(b7ffc6d,含 #3 balance/server/加密)**之上完整重做:
plugins/auth/*.lua。对照 #4 验收清单
crates/gateway内 grep 不到 kimi/commandcode 等平台标识与端点常量(平台常量只在plugins/auth/*.lua)capabilities=["auth"]插件即可)secrets表挂载本仓库既有EncKey链路(AES-256-GCM + 主密钥文件/DPAPI);不进provider.extra、不整体回传前端、不落日志(provider 行只记非敏感extra.auth,端点api_key置空)mb.http(30s 兜底超时 + 不跟随重定向)+ host 按 provider 键单飞(持锁期间不做无超时网络等待);失败回退旧令牌 + 60s 退避;上游 401 强制刷新并重发本端点一次crates/gateway/tests/auth_plugins.rs,axum mock;另有引擎级单飞并发/退避/契约测试 12 项)oauth_flows/listener 在完成/超时/取消均清理(flow 作用域释放 +CallbackRegistry::drop兜底).github/workflows/ci.yml:fmt --check / clippy -D warnings / workspace test + 前端 type-check/build)三个开放决策的取舍
mb.fs.read——白名单由插件MB.fs_read_allow声明(home 相对、精确匹配、无通配),宿主侧再做 home 包含性复查;来源选择经ctx.source显式传递(describe.sources广告,UI 先选「本地导入/浏览器」),whoami 失败显式报错不静默装成功mb.crypto已具备 S256 条件,后续平台需要时再加)encryption_metadata迁移,secrets 表直接挂载(不再另起 keyring 方案)其它说明
crates/gateway/src/oauth.rs(master 的auth.rs是管理 token 校验,避免撞名)script_ref断言 UNC 前缀、admin/trace.rs绝对路径拒绝的状态码语义、lifecycle.rs子进程env_clear缺SystemRoot致 Winsock 10106web.ts对未实现 command 已显式报错);删除 provider 已级联清理 secrets 令牌包--ignored):Kimi 设备授权已直打真实auth.kimi.com验证通过(src-tauri/tests/real_login_smoke.rs)测试
cargo test --workspace全绿(含 server;Windows 本地口径 380+ 项:store 17+8 / plugin 28+7+1 / gateway 96+34+31+7 / protocol 111 / server 42+32+1 / app 28+2 smoke),clippy/fmt 零告警,pnpm type-check无错、pnpm build通过。