Files
ElyOffice/tasks/reviews/C12.4-r1.md
T
ZacharyZhang-NYandClaude bd68382921 C12.4: mail credentials and OAuth sign-in
Passwords and refresh tokens go only to the system keychain; a refused
keychain keeps them in memory until exit and says why. Gmail and
Microsoft sign in by authorization code with S256 PKCE on a loopback
redirect; refresh tokens are kept, and revoked grants ask to sign in
again. Client IDs come from the build (env or oauth.env). ureq trace
records never reach the log.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-19 18:59:56 -04:00

10 lines
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
FAIL
- crates/ely-mail-engine/src/oauth.rs:99 — [P1] Google 授权 URL 没有 `access_type=offline`。[Google 文档](https://developers.google.com/identity/openid-connect/openid-connect#refresh-tokens)规定,请求离线访问才会在换码时取得刷新令牌。首次添加 Gmail 时,即使用户授权成功,也可能只得到短期 access token;到期或重启后无法完成 C12.4 要求的刷新。隔离探针调用实际 `google()` 和 `SignIn::start`,断言该参数时得到 `None`(`.work/C12.4-r1/linux-probes.log`);现有测试的自定义 provider 掩盖了这个缺口。修复方向:Google 授权请求加入离线访问参数,并测试内置 provider 的授权参数与刷新令牌签发条件。
- crates/ely-mail-engine/src/oauth.rs:60 — [P2] Microsoft scope 缺少 `profile`,但邮箱读取依赖 `preferred_username` 作为 `email` 缺失时的回退。[Microsoft 文档](https://learn.microsoft.com/en-us/entra/identity-platform/id-token-claims-reference)明确该 claim 需要 `profile` scope。因此,未提供 `email` claim 的账号完成授权后,也拿不到承诺的回退值,`Tokens.email` 仍为空。实际 `microsoft()` 的参数探针确认没有申请此 scope(`.work/C12.4-r1/linux-probes.log`)。修复方向:申请该 claim 所需的 scope,补测 Microsoft 无 email、使用 preferred_username 的路径。
- crates/ely-mail-engine/build.rs:16 — [P2] `read_to_string` 的所有错误都直接返回,文件不存在与文件损坏、无法读取被混为一谈。复现:隔离编译原始 build.rs,让其读取含无效 UTF-8 的 `oauth.env`,退出码仍为 0,且没有配置错误提示(`.work/C12.4-r1/config-invalid-utf8.log`)。正常没有环境变量的本机构建会悄悄忽略已有配置,把登录变为 `Unavailable`,违反错误必须暴露与坏配置构建失败的要求。修复方向:只允许 NotFound 表示未配置,其余读取错误使构建失败并说明原因,补测损坏与不可读文件。
- crates/ely-mail-engine/src/oauth/loopback.rs:14 — [P3] 新增注释 `Serves the redirect until it carries a code or an error.` 共 11 词,超过 agents.md 的十词限制;运行项目 `tests/scripts/comments.py` 可复现该行失败。修复方向:缩短到十词以内。