Repository navigation
feat(lark): 平台团队成员(人)在团队群 talk 免 /grant + 协作群 bot 首次接触腿 - #369
Merged
Hidden character warning
The head ref may contain hidden characters: "feat/team-member-talk-\u514dgrant"
Merged
Conversation
配合 platform team-sync 下发 memberUnionIds/协作群,打通「双方最新 master 后平台 拉的新群里人和 bot 仍要 /grant」的两个缺口: - evaluateTalk 新增 teamMember 腿:发送者 union_id 是本群所属平台团队的成员 (isPlatformTeamMemberChat:成员与群同团队)→ talk 免 grant。严格 chat 作用域、 talk-only:canOperate 不引这一腿,/restart 等仍限 allowedUsers。 - 安全:evaluateTalk/canTalk 拆出两个 union 入参——senderUnionId 走 teamBot 腿 (调用方按 sender_type 锁 bot),memberUnionId 走 teamMember 腿(可为真人 union)。 真人 union 绝不进 bot-trust 腿,堵住「恶意成员把真人 union 报成 bot 骗 operate」。 - 端到端:enforceMessageQuotaForCliInput 透传 memberUnionId(原始 union),否则人的 团队成员消息会在配额复查处被 evaluateTalk 静默丢弃(#332 同类断点,人腿版)。 - platform-team-store:sanitize/落盘 memberUnionIds + isPlatformTeamMemberChat 谓词。 - 协作群 bot 首次接触腿本就靠 isTeamGroupChat(team-sync 镜像的 groupChatIds),平台 这次真正下发协作群后自动生效,无需 daemon 改动。 新增 8 条单测(teamMember 腿 chat 作用域/talk-only/跨团队不泄漏/bot-trust 不误命中); platform-team-store/trust/union 全绿,tsc + build 绿。
Owner
Author
Codex review:通过,无阻塞问题用 codex CLI 对本分支 diff 做了 review,重点审的三处安全不变量全部确认无误:
测试覆盖被确认到位(teamMember talk-only / chat-scoped / 成员 union 塞进 bot-trust 槽不触发 teamBot/operate / 跨团队不匹配)。 残余说明:Codex 为静态 review 未跑测试(本地 tsc + 23 条相关单测 + build 已绿)。 |
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.
背景
双方 botmux 都更新到最新 master 后,平台拉的新群里 bot 和人仍要 /grant(申晗实测截图)。定位到两个独立缺口:
平台侧(已直推 master,配套):
/api/groups/create记协作群进团队 groupChatIds、下发 memberUnionIds、团队变更主动推送消竞态。本 PR 是 daemon 侧。改动
isPlatformTeamMemberChat:成员与群必须同团队)→ talk 免 grant。严格 chat 作用域(不是全局)、talk-only(canOperate 不引这一腿,/restart/终端写入等仍限 allowedUsers)。senderUnionId走 teamBot 腿(调用方必须已按 sender_type 锁定为 bot 发送方),memberUnionId走 teamMember 腿(可为真人 union)。真人 union 绝不进 bot-trust 腿,堵住「恶意成员把真人 union_id 报成自家 bot 骗取 talk+operate」——与既有 teamTrustUnionId 守卫同一结构。enforceMessageQuotaForCliInput透传 memberUnionId(原始 union),否则人的团队成员消息会在配额复查处被 evaluateTalk 静默丢弃。三个调用点(初始 passthrough / 普通 / thread)都透传。isTeamGroupChat(team-sync 镜像的 groupChatIds),平台这次真正下发协作群后自动生效,daemon 零改动。isPlatformTeamMemberChat谓词。验证
isPlatformTeamMemberChat边界。Review 关注点