fix(controller): enforce ownership on notification group, NAT server, and batch move

Co-authored-by: naiba/CloudCode <hi+cloudcode@nai.ba>
This commit is contained in:
naiba
2026-05-17 10:24:19 +08:00
co-authored by naiba/CloudCode
parent 423175a425
commit a5995ce045
6 changed files with 109 additions and 32 deletions
+4 -2
View File
@@ -194,8 +194,6 @@ func validateRule(c *gin.Context, r *model.AlertRule) error {
return singleton.Localizer.ErrorT("need to configure at least a single rule")
}
// Trigger task IDs are user-controlled; validate them here so alerts cannot
// reference another user's cron and later execute it from the sentinel path.
if !singleton.CronShared.CheckPermission(c, slices.Values(r.FailTriggerTasks)) {
return singleton.Localizer.ErrorT("permission denied")
}
@@ -203,5 +201,9 @@ func validateRule(c *gin.Context, r *model.AlertRule) error {
return singleton.Localizer.ErrorT("permission denied")
}
if err := assertOwnsNotificationGroup(c, r.NotificationGroupID); err != nil {
return err
}
return nil
}