Skip to content

Commit 8811df5

Browse files
committed
feat(aichat): add perm check for cross-group
1 parent f09f159 commit 8811df5

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

plugin/aichat/main.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,17 @@ func init() {
159159
}
160160
logrus.Infoln("[aichat] agent do:", reqs)
161161
for _, req := range reqs {
162+
if req.Action == "send_group_msg" {
163+
gid, ok := req.Params["group_id"].(int64)
164+
if !ok {
165+
logrus.Warnln("[aichat] invalid", req.Action, req.Params)
166+
continue
167+
}
168+
if ctx.Event.GroupID != gid && !zero.SuperUserPermission(ctx) {
169+
logrus.Warnln("[aichat] refuse to send out of grp from", ctx.Event.GroupID, "to", gid)
170+
continue
171+
}
172+
}
162173
ctx.CallAction(req.Action, req.Params)
163174
process.SleepAbout1sTo2s()
164175
}

0 commit comments

Comments
 (0)