fix(channel,user): owner 车道只认白名单,堵住群主/伪造 role 冒充主人(裁决 06.4.2/06.4.3/06.4.4)

- 适配器只描述平台身份:qq_obv11 的 owner/admin 一律上报 RoleMember,不再上报 RoleOwner
- session 层唯一判主点只认白名单(owner.yaml Accounts ∪ 每渠道 adminIds),nil 档案 fail-closed 拒绝
- 新增「每渠道管理员层」:channels.json ChannelAccount.adminIds[] → runtimeconfig.AdminIDs → OwnerProfile.SetPlatformAdmins(整体替换语义,热重载后移除的 id 立即失效)
- 组合根接线:启动即播种、面板保存先灌白名单再重载适配器(cmd/cyrene/wire_channels.go + 4 条端到端单测)
- 06.4.3 节流与参与度状态按会话独立计数(ConversationKey 三处统一,空会话 GC);06.4.4 未知平台主动发言保守默认 1 条/分钟
This commit is contained in:
AskaEth committed 2026-10-04 12:07:40 +08:00
1 parent 7e7f53bb41
commit af8591b78a
30 files changed
+1289 -144

No files matched your search

+7 -10
View File
@@ -96,18 +96,15 @@ func (b *Bridge) engageConfigured() bool {
return len(b.triggerWords) > 0 || b.engage.Enabled || b.engage.Probability > 0
}
// engageKey returns the per-conversation state key (design/18 §1: 群聊会话 platform:groupID).
// A stranger direct chat (no group) falls back to platform:senderID so the engine still
// applies to one-to-one strangers.
// engageKey 返回该会话在参与度引擎里的状态键(design/18 §1/§6,裁决 06.4.3)。键口径与
// 入站节流**完全一致**:adapter.ConversationKey(platform+channelID+groupID/peerID),
// 所以同一会话在「滑窗计数」和「参与度状态机」里落在同一个桶——两个群并发互不挤占。
// 群聊缺 group id 时用 actor 上报的群 id 补齐(适配器可能只填了 Sender.GroupID)。
func engageKey(msg adapter.UnifiedMessage, actor adapter.Actor) string {
if msg.IsGroup() || actor.IsGroupChat() || actor.GroupID != "" {
g := msg.GroupID
if g == "" {
g = actor.GroupID
}
return msg.Platform + ":" + g
if msg.GroupID == "" && (msg.IsGroup() || actor.IsGroupChat() || actor.GroupID != "") {
msg.GroupID = actor.GroupID
}
return msg.Platform + ":" + firstNonEmptyStr(msg.SenderID, msg.Sender.UserID)
return adapter.ConversationKey(msg)
}
// engageState returns the state for a conversation key, creating an IDLE instance on