Alerting: Verify receiver permission read on rule create/update (#94286)

* Alerting: Verify receiver permission read on rule create/update
This commit is contained in:
Matthew Jacobson
2024-10-04 23:52:38 +03:00
committed by GitHub
parent 27c7e33217
commit 099055e8a5
5 changed files with 149 additions and 40 deletions
@@ -35,6 +35,10 @@ type NotificationSettings struct {
MuteTimeIntervals []string `json:"mute_time_intervals,omitempty"`
}
func (s *NotificationSettings) GetUID() string {
return NameToUid(s.Receiver)
}
// NormalizedGroupBy returns a consistent and ordered GroupBy.
// - If the GroupBy is empty, it returns nil so that the parent group can be inherited.
// - If the GroupBy contains the special label '...', it returns only '...'.
+5
View File
@@ -2,6 +2,7 @@ package models
import (
"context"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
@@ -559,6 +560,10 @@ func (r *Receiver) GetUID() string {
return r.UID
}
func NameToUid(name string) string {
return base64.RawURLEncoding.EncodeToString([]byte(name))
}
func (r *Receiver) Fingerprint() string {
sum := newFingerprint()