feat: 新增注册业务维度以及获取同provider下不同邮箱#27
Open
africa1207 wants to merge 1 commit into
Open
Conversation
- 根据业务project维度定义used状态 - 可获取不同provider下不同email_domain
Owner
|
已经合并到dev分支上面,等到下个版本测试完成,会正式合并到main分支 |
Owner
|
已接入 |
ZeroPointSix
left a comment
Owner
There was a problem hiding this comment.
总体结论:本轮巡检覆盖 PR #27 当前 head c597effb18fae11701a08f81619643c54dbdd830。项目级邮箱池复用和按 email_domain 领取的方向是合理的,但 claim 级读信路径缺少当前 API key/consumer 与 claim 所属 consumer 的一致性校验,建议合并前修复。
关键发现:
- 阻塞:
outlook_web/services/external_api.py的resolve_claim_context()通过pool_service.get_claim_context(claim_token=...)解析 claim 后,只调用ensure_external_email_access(claim_email),没有校验claim_context["consumer_key"]是否等于当前请求的get_external_api_consumer()["consumer_key"]。影响是:只要另一个外部调用方拿到或猜到有效claim_token,就可能用自己的 API key 调用verification-code/verification-link/wait-message读取该 claim 对应邮箱的上下文。release_claim()/complete_claim()已经校验 consumer,但读信链路没有同等隔离。 - 高:建议把当前 consumer 传入
resolve_external_mail_scope()/resolve_claim_context(),或者在resolve_claim_context()内部读取当前 consumer,并在claim_context["consumer_key"]非空且不匹配时返回 403,例如CLAIM_CONSUMER_MISMATCH。这应当在所有 claim_token 读信入口生效,而不是只在 pool complete/release 生效。 - 中:建议补一条回归测试:API key A claim 出邮箱后,API key B 使用同一个
claim_token调用/api/external/verification-code应返回 403,且不能触发 Graph/IMAP 读信;同一 consumer 下的正常 claim_token 读信仍应通过。 - 低:文档已经建议 claim 级读信优先使用
claim_token,因此这里的隔离语义最好也写进文档:claim_token 只能被原 consumer 使用,不能跨 API key/consumer 复用。
优先级建议:
- 阻塞:补上 claim_token 读信的 consumer 隔离校验。
- 高:补跨 consumer 负例测试,防止后续外部 API 重构时回退。
- 中:确认
get-messages/latest-message/verification-code/verification-link/wait-message这些 claim_token 入口全部走同一校验函数。
后续建议:
- 修复后建议重跑外部 API 与邮箱池相关测试,尤其是
tests/test_external_api.py和tests/test_pool_flow_suite.py。如果要保留 legacy claim(claimed_by中没有 consumer_key)的兼容窗口,也建议明确只允许 legacy claim 在原有单 consumer 场景下读取,避免多 consumer 部署中出现模糊授权。
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.
Pull request type / PR 类型
Please check the type of change your PR introduces / 请勾选 PR 引入的更改类型:
What is the current behavior? / 当前行为是什么?
Issue Number / Issue 编号: N/A
What is the new behavior? / 新行为是什么?
Other information / 其他信息