修复邮件详情与规则更新的水平越权漏洞 (#351)

* fix(auth): enforce email detail ownership

* fix(rules): scope updates to owning user
This commit is contained in:
NikoCat233 authored and GitHub committed 2026-07-22 15:58:56 +08:00
1 parent da55756917
commit 593c3fb720
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -20,7 +20,7 @@ import . "xorm.io/builder"
func GetEmailDetail(ctx *context.Context, id int, markRead bool) (*response.EmailResponseData, error) {
// 先查是否是本人的邮件
var ue models.UserEmail
_, err := db.Instance.Where("email_id = ?", id).Get(&ue)
_, err := db.Instance.Where("email_id = ? AND user_id = ?", id, ctx.UserID).Get(&ue)
if err != nil {
log.Error(err)
}