From 9122e7f647f44c1ceb7b9eb0e05beff4e23dc9cd Mon Sep 17 00:00:00 2001 From: George Robinson Date: Mon, 22 Nov 2021 11:56:18 +0000 Subject: [PATCH] Alerting: Check for nil model.Settings and models.SecureSettings (#37738) --- .../ngalert/notifier/channels/alertmanager.go | 4 +++- .../notifier/channels/alertmanager_test.go | 16 ++++++++++------ .../ngalert/notifier/channels/dingding.go | 2 +- .../ngalert/notifier/channels/discord.go | 2 +- pkg/services/ngalert/notifier/channels/email.go | 2 +- .../ngalert/notifier/channels/googlechat.go | 4 ++++ pkg/services/ngalert/notifier/channels/kafka.go | 4 ++++ pkg/services/ngalert/notifier/channels/line.go | 7 +++++++ .../ngalert/notifier/channels/line_test.go | 8 +++++--- .../ngalert/notifier/channels/opsgenie.go | 6 ++++++ .../ngalert/notifier/channels/opsgenie_test.go | 8 +++++--- .../ngalert/notifier/channels/pagerduty.go | 3 +++ .../ngalert/notifier/channels/pagerduty_test.go | 8 +++++--- .../ngalert/notifier/channels/pushover.go | 3 +++ .../ngalert/notifier/channels/pushover_test.go | 8 +++++--- .../ngalert/notifier/channels/sensugo.go | 4 +++- .../ngalert/notifier/channels/sensugo_test.go | 8 +++++--- pkg/services/ngalert/notifier/channels/slack.go | 3 +++ .../ngalert/notifier/channels/slack_test.go | 8 +++++--- .../ngalert/notifier/channels/telegram.go | 3 +++ .../ngalert/notifier/channels/telegram_test.go | 8 +++++--- .../ngalert/notifier/channels/threema.go | 4 +++- .../ngalert/notifier/channels/threema_test.go | 8 +++++--- .../ngalert/notifier/channels/victorops.go | 4 ++++ .../ngalert/notifier/channels/webhook.go | 5 ++++- .../ngalert/notifier/channels/webhook_test.go | 10 ++++++---- 26 files changed, 109 insertions(+), 41 deletions(-) diff --git a/pkg/services/ngalert/notifier/channels/alertmanager.go b/pkg/services/ngalert/notifier/channels/alertmanager.go index 99485420e14..6f9abc0d242 100644 --- a/pkg/services/ngalert/notifier/channels/alertmanager.go +++ b/pkg/services/ngalert/notifier/channels/alertmanager.go @@ -22,7 +22,9 @@ func NewAlertmanagerNotifier(model *NotificationChannelConfig, _ *template.Templ if model.Settings == nil { return nil, receiverInitError{Reason: "no settings supplied"} } - + if model.SecureSettings == nil { + return nil, receiverInitError{Cfg: *model, Reason: "no secure settings supplied"} + } urlStr := model.Settings.Get("url").MustString() if urlStr == "" { return nil, receiverInitError{Reason: "could not find url property in settings", Cfg: *model} diff --git a/pkg/services/ngalert/notifier/channels/alertmanager_test.go b/pkg/services/ngalert/notifier/channels/alertmanager_test.go index 35790d4f224..b548edf4b59 100644 --- a/pkg/services/ngalert/notifier/channels/alertmanager_test.go +++ b/pkg/services/ngalert/notifier/channels/alertmanager_test.go @@ -49,11 +49,13 @@ func TestNewAlertmanagerNotifier(t *testing.T) { t.Run(c.name, func(t *testing.T) { settingsJSON, err := simplejson.NewJson([]byte(c.settings)) require.NoError(t, err) + secureSettings := make(map[string][]byte) m := &NotificationChannelConfig{ - Name: c.receiverName, - Type: "alertmanager", - Settings: settingsJSON, + Name: c.receiverName, + Type: "alertmanager", + Settings: settingsJSON, + SecureSettings: secureSettings, } secretsService := secretsManager.SetupTestService(t, fakes.NewFakeSecretsStore()) @@ -130,11 +132,13 @@ func TestAlertmanagerNotifier_Notify(t *testing.T) { t.Run(c.name, func(t *testing.T) { settingsJSON, err := simplejson.NewJson([]byte(c.settings)) require.NoError(t, err) + secureSettings := make(map[string][]byte) m := &NotificationChannelConfig{ - Name: c.receiverName, - Type: "alertmanager", - Settings: settingsJSON, + Name: c.receiverName, + Type: "alertmanager", + Settings: settingsJSON, + SecureSettings: secureSettings, } secretsService := secretsManager.SetupTestService(t, fakes.NewFakeSecretsStore()) diff --git a/pkg/services/ngalert/notifier/channels/dingding.go b/pkg/services/ngalert/notifier/channels/dingding.go index e6ac8d5f895..8a131246456 100644 --- a/pkg/services/ngalert/notifier/channels/dingding.go +++ b/pkg/services/ngalert/notifier/channels/dingding.go @@ -19,7 +19,7 @@ const defaultDingdingMsgType = "link" // NewDingDingNotifier is the constructor for the Dingding notifier func NewDingDingNotifier(model *NotificationChannelConfig, t *template.Template) (*DingDingNotifier, error) { if model.Settings == nil { - return nil, receiverInitError{Reason: "no settings supplied", Cfg: *model} + return nil, receiverInitError{Cfg: *model, Reason: "no settings supplied"} } url := model.Settings.Get("url").MustString() diff --git a/pkg/services/ngalert/notifier/channels/discord.go b/pkg/services/ngalert/notifier/channels/discord.go index 5842445180d..bb606489051 100644 --- a/pkg/services/ngalert/notifier/channels/discord.go +++ b/pkg/services/ngalert/notifier/channels/discord.go @@ -28,7 +28,7 @@ type DiscordNotifier struct { func NewDiscordNotifier(model *NotificationChannelConfig, t *template.Template) (*DiscordNotifier, error) { if model.Settings == nil { - return nil, receiverInitError{Reason: "no settings supplied", Cfg: *model} + return nil, receiverInitError{Cfg: *model, Reason: "no settings supplied"} } avatarURL := model.Settings.Get("avatar_url").MustString() diff --git a/pkg/services/ngalert/notifier/channels/email.go b/pkg/services/ngalert/notifier/channels/email.go index 574f3d2ff91..a891861805a 100644 --- a/pkg/services/ngalert/notifier/channels/email.go +++ b/pkg/services/ngalert/notifier/channels/email.go @@ -29,7 +29,7 @@ type EmailNotifier struct { // for the EmailNotifier. func NewEmailNotifier(model *NotificationChannelConfig, t *template.Template) (*EmailNotifier, error) { if model.Settings == nil { - return nil, receiverInitError{Reason: "no settings supplied", Cfg: *model} + return nil, receiverInitError{Cfg: *model, Reason: "no settings supplied"} } addressesString := model.Settings.Get("addresses").MustString() diff --git a/pkg/services/ngalert/notifier/channels/googlechat.go b/pkg/services/ngalert/notifier/channels/googlechat.go index 307026fb8cf..1b96f81c133 100644 --- a/pkg/services/ngalert/notifier/channels/googlechat.go +++ b/pkg/services/ngalert/notifier/channels/googlechat.go @@ -25,6 +25,10 @@ type GoogleChatNotifier struct { } func NewGoogleChatNotifier(model *NotificationChannelConfig, t *template.Template) (*GoogleChatNotifier, error) { + if model.Settings == nil { + return nil, receiverInitError{Cfg: *model, Reason: "no settings supplied"} + } + url := model.Settings.Get("url").MustString() if url == "" { return nil, receiverInitError{Cfg: *model, Reason: "could not find url property in settings"} diff --git a/pkg/services/ngalert/notifier/channels/kafka.go b/pkg/services/ngalert/notifier/channels/kafka.go index bcfd9d052c0..9b007ffaea6 100644 --- a/pkg/services/ngalert/notifier/channels/kafka.go +++ b/pkg/services/ngalert/notifier/channels/kafka.go @@ -27,6 +27,10 @@ type KafkaNotifier struct { // NewKafkaNotifier is the constructor function for the Kafka notifier. func NewKafkaNotifier(model *NotificationChannelConfig, t *template.Template) (*KafkaNotifier, error) { + if model.Settings == nil { + return nil, receiverInitError{Cfg: *model, Reason: "no settings supplied"} + } + endpoint := model.Settings.Get("kafkaRestProxy").MustString() if endpoint == "" { return nil, receiverInitError{Cfg: *model, Reason: "could not find kafka rest proxy endpoint property in settings"} diff --git a/pkg/services/ngalert/notifier/channels/line.go b/pkg/services/ngalert/notifier/channels/line.go index 9cebd032c60..9a4444ceb61 100644 --- a/pkg/services/ngalert/notifier/channels/line.go +++ b/pkg/services/ngalert/notifier/channels/line.go @@ -19,6 +19,13 @@ var ( // NewLineNotifier is the constructor for the LINE notifier func NewLineNotifier(model *NotificationChannelConfig, t *template.Template, fn GetDecryptedValueFn) (*LineNotifier, error) { + if model.Settings == nil { + return nil, receiverInitError{Cfg: *model, Reason: "no settings supplied"} + } + if model.SecureSettings == nil { + return nil, receiverInitError{Cfg: *model, Reason: "no secure settings supplied"} + } + token := fn(context.Background(), model.SecureSettings, "token", model.Settings.Get("token").MustString()) if token == "" { return nil, receiverInitError{Cfg: *model, Reason: "could not find token in settings"} diff --git a/pkg/services/ngalert/notifier/channels/line_test.go b/pkg/services/ngalert/notifier/channels/line_test.go index bf1f732ae48..11e0aea1a25 100644 --- a/pkg/services/ngalert/notifier/channels/line_test.go +++ b/pkg/services/ngalert/notifier/channels/line_test.go @@ -83,11 +83,13 @@ func TestLineNotifier(t *testing.T) { t.Run(c.name, func(t *testing.T) { settingsJSON, err := simplejson.NewJson([]byte(c.settings)) require.NoError(t, err) + secureSettings := make(map[string][]byte) m := &NotificationChannelConfig{ - Name: "line_testing", - Type: "line", - Settings: settingsJSON, + Name: "line_testing", + Type: "line", + Settings: settingsJSON, + SecureSettings: secureSettings, } secretsService := secretsManager.SetupTestService(t, fakes.NewFakeSecretsStore()) diff --git a/pkg/services/ngalert/notifier/channels/opsgenie.go b/pkg/services/ngalert/notifier/channels/opsgenie.go index b33b806a19c..ef8c776fbc9 100644 --- a/pkg/services/ngalert/notifier/channels/opsgenie.go +++ b/pkg/services/ngalert/notifier/channels/opsgenie.go @@ -42,6 +42,12 @@ type OpsgenieNotifier struct { // NewOpsgenieNotifier is the constructor for the Opsgenie notifier func NewOpsgenieNotifier(model *NotificationChannelConfig, t *template.Template, fn GetDecryptedValueFn) (*OpsgenieNotifier, error) { + if model.Settings == nil { + return nil, receiverInitError{Cfg: *model, Reason: "no settings supplied"} + } + if model.SecureSettings == nil { + return nil, receiverInitError{Cfg: *model, Reason: "no secure settings supplied"} + } autoClose := model.Settings.Get("autoClose").MustBool(true) overridePriority := model.Settings.Get("overridePriority").MustBool(true) apiKey := fn(context.Background(), model.SecureSettings, "apiKey", model.Settings.Get("apiKey").MustString()) diff --git a/pkg/services/ngalert/notifier/channels/opsgenie_test.go b/pkg/services/ngalert/notifier/channels/opsgenie_test.go index 19a740c8237..b0842d8776d 100644 --- a/pkg/services/ngalert/notifier/channels/opsgenie_test.go +++ b/pkg/services/ngalert/notifier/channels/opsgenie_test.go @@ -163,11 +163,13 @@ func TestOpsgenieNotifier(t *testing.T) { t.Run(c.name, func(t *testing.T) { settingsJSON, err := simplejson.NewJson([]byte(c.settings)) require.NoError(t, err) + secureSettings := make(map[string][]byte) m := &NotificationChannelConfig{ - Name: "opsgenie_testing", - Type: "opsgenie", - Settings: settingsJSON, + Name: "opsgenie_testing", + Type: "opsgenie", + Settings: settingsJSON, + SecureSettings: secureSettings, } secretsService := secretsManager.SetupTestService(t, fakes.NewFakeSecretsStore()) diff --git a/pkg/services/ngalert/notifier/channels/pagerduty.go b/pkg/services/ngalert/notifier/channels/pagerduty.go index 1b3fb980a72..6f1489cb784 100644 --- a/pkg/services/ngalert/notifier/channels/pagerduty.go +++ b/pkg/services/ngalert/notifier/channels/pagerduty.go @@ -44,6 +44,9 @@ func NewPagerdutyNotifier(model *NotificationChannelConfig, t *template.Template if model.Settings == nil { return nil, receiverInitError{Cfg: *model, Reason: "no settings supplied"} } + if model.SecureSettings == nil { + return nil, receiverInitError{Cfg: *model, Reason: "no secure settings supplied"} + } key := fn(context.Background(), model.SecureSettings, "integrationKey", model.Settings.Get("integrationKey").MustString()) if key == "" { diff --git a/pkg/services/ngalert/notifier/channels/pagerduty_test.go b/pkg/services/ngalert/notifier/channels/pagerduty_test.go index 3667fa8c0ec..a2968f2a404 100644 --- a/pkg/services/ngalert/notifier/channels/pagerduty_test.go +++ b/pkg/services/ngalert/notifier/channels/pagerduty_test.go @@ -129,11 +129,13 @@ func TestPagerdutyNotifier(t *testing.T) { t.Run(c.name, func(t *testing.T) { settingsJSON, err := simplejson.NewJson([]byte(c.settings)) require.NoError(t, err) + secureSettings := make(map[string][]byte) m := &NotificationChannelConfig{ - Name: "pageduty_testing", - Type: "pagerduty", - Settings: settingsJSON, + Name: "pageduty_testing", + Type: "pagerduty", + Settings: settingsJSON, + SecureSettings: secureSettings, } secretsService := secretsManager.SetupTestService(t, fakes.NewFakeSecretsStore()) diff --git a/pkg/services/ngalert/notifier/channels/pushover.go b/pkg/services/ngalert/notifier/channels/pushover.go index ad7ff9bc830..90b04612609 100644 --- a/pkg/services/ngalert/notifier/channels/pushover.go +++ b/pkg/services/ngalert/notifier/channels/pushover.go @@ -43,6 +43,9 @@ func NewPushoverNotifier(model *NotificationChannelConfig, t *template.Template, if model.Settings == nil { return nil, receiverInitError{Cfg: *model, Reason: "no settings supplied"} } + if model.SecureSettings == nil { + return nil, receiverInitError{Cfg: *model, Reason: "no secure settings supplied"} + } userKey := fn(context.Background(), model.SecureSettings, "userKey", model.Settings.Get("userKey").MustString()) APIToken := fn(context.Background(), model.SecureSettings, "apiToken", model.Settings.Get("apiToken").MustString()) diff --git a/pkg/services/ngalert/notifier/channels/pushover_test.go b/pkg/services/ngalert/notifier/channels/pushover_test.go index 2373ac1eb03..7f340e37b45 100644 --- a/pkg/services/ngalert/notifier/channels/pushover_test.go +++ b/pkg/services/ngalert/notifier/channels/pushover_test.go @@ -137,11 +137,13 @@ func TestPushoverNotifier(t *testing.T) { t.Run(c.name, func(t *testing.T) { settingsJSON, err := simplejson.NewJson([]byte(c.settings)) require.NoError(t, err) + secureSettings := make(map[string][]byte) m := &NotificationChannelConfig{ - Name: "pushover_testing", - Type: "pushover", - Settings: settingsJSON, + Name: "pushover_testing", + Type: "pushover", + Settings: settingsJSON, + SecureSettings: secureSettings, } secretsService := secretsManager.SetupTestService(t, fakes.NewFakeSecretsStore()) diff --git a/pkg/services/ngalert/notifier/channels/sensugo.go b/pkg/services/ngalert/notifier/channels/sensugo.go index d93e2bcb8ef..5f45f6892f0 100644 --- a/pkg/services/ngalert/notifier/channels/sensugo.go +++ b/pkg/services/ngalert/notifier/channels/sensugo.go @@ -34,7 +34,9 @@ func NewSensuGoNotifier(model *NotificationChannelConfig, t *template.Template, if model.Settings == nil { return nil, receiverInitError{Cfg: *model, Reason: "no settings supplied"} } - + if model.SecureSettings == nil { + return nil, receiverInitError{Cfg: *model, Reason: "no secure settings supplied"} + } url := model.Settings.Get("url").MustString() if url == "" { return nil, receiverInitError{Cfg: *model, Reason: "could not find URL property in settings"} diff --git a/pkg/services/ngalert/notifier/channels/sensugo_test.go b/pkg/services/ngalert/notifier/channels/sensugo_test.go index 2afa0c38bfe..fd07e16ff8e 100644 --- a/pkg/services/ngalert/notifier/channels/sensugo_test.go +++ b/pkg/services/ngalert/notifier/channels/sensugo_test.go @@ -134,11 +134,13 @@ func TestSensuGoNotifier(t *testing.T) { t.Run(c.name, func(t *testing.T) { settingsJSON, err := simplejson.NewJson([]byte(c.settings)) require.NoError(t, err) + secureSettings := make(map[string][]byte) m := &NotificationChannelConfig{ - Name: "Sensu Go", - Type: "sensugo", - Settings: settingsJSON, + Name: "Sensu Go", + Type: "sensugo", + Settings: settingsJSON, + SecureSettings: secureSettings, } secretsService := secretsManager.SetupTestService(t, fakes.NewFakeSecretsStore()) diff --git a/pkg/services/ngalert/notifier/channels/slack.go b/pkg/services/ngalert/notifier/channels/slack.go index 58d0a045f9b..e91b5d41328 100644 --- a/pkg/services/ngalert/notifier/channels/slack.go +++ b/pkg/services/ngalert/notifier/channels/slack.go @@ -48,6 +48,9 @@ func NewSlackNotifier(model *NotificationChannelConfig, t *template.Template, fn if model.Settings == nil { return nil, receiverInitError{Cfg: *model, Reason: "no settings supplied"} } + if model.SecureSettings == nil { + return nil, receiverInitError{Cfg: *model, Reason: "no secure settings supplied"} + } slackURL := fn(context.Background(), model.SecureSettings, "url", model.Settings.Get("url").MustString()) if slackURL == "" { diff --git a/pkg/services/ngalert/notifier/channels/slack_test.go b/pkg/services/ngalert/notifier/channels/slack_test.go index ef939536830..a4053961675 100644 --- a/pkg/services/ngalert/notifier/channels/slack_test.go +++ b/pkg/services/ngalert/notifier/channels/slack_test.go @@ -165,11 +165,13 @@ func TestSlackNotifier(t *testing.T) { t.Run(c.name, func(t *testing.T) { settingsJSON, err := simplejson.NewJson([]byte(c.settings)) require.NoError(t, err) + secureSettings := make(map[string][]byte) m := &NotificationChannelConfig{ - Name: "slack_testing", - Type: "slack", - Settings: settingsJSON, + Name: "slack_testing", + Type: "slack", + Settings: settingsJSON, + SecureSettings: secureSettings, } secretsService := secretsManager.SetupTestService(t, fakes.NewFakeSecretsStore()) diff --git a/pkg/services/ngalert/notifier/channels/telegram.go b/pkg/services/ngalert/notifier/channels/telegram.go index cea09366e0f..366338ed76b 100644 --- a/pkg/services/ngalert/notifier/channels/telegram.go +++ b/pkg/services/ngalert/notifier/channels/telegram.go @@ -33,6 +33,9 @@ func NewTelegramNotifier(model *NotificationChannelConfig, t *template.Template, if model.Settings == nil { return nil, receiverInitError{Cfg: *model, Reason: "no settings supplied"} } + if model.SecureSettings == nil { + return nil, receiverInitError{Cfg: *model, Reason: "no secure settings supplied"} + } botToken := fn(context.Background(), model.SecureSettings, "bottoken", model.Settings.Get("bottoken").MustString()) chatID := model.Settings.Get("chatid").MustString() diff --git a/pkg/services/ngalert/notifier/channels/telegram_test.go b/pkg/services/ngalert/notifier/channels/telegram_test.go index b45b7019902..b0a431eb111 100644 --- a/pkg/services/ngalert/notifier/channels/telegram_test.go +++ b/pkg/services/ngalert/notifier/channels/telegram_test.go @@ -89,11 +89,13 @@ func TestTelegramNotifier(t *testing.T) { t.Run(c.name, func(t *testing.T) { settingsJSON, err := simplejson.NewJson([]byte(c.settings)) require.NoError(t, err) + secureSettings := make(map[string][]byte) m := &NotificationChannelConfig{ - Name: "telegram_testing", - Type: "telegram", - Settings: settingsJSON, + Name: "telegram_testing", + Type: "telegram", + Settings: settingsJSON, + SecureSettings: secureSettings, } secretsService := secretsManager.SetupTestService(t, fakes.NewFakeSecretsStore()) diff --git a/pkg/services/ngalert/notifier/channels/threema.go b/pkg/services/ngalert/notifier/channels/threema.go index d1ed3244511..138f7b3e1c9 100644 --- a/pkg/services/ngalert/notifier/channels/threema.go +++ b/pkg/services/ngalert/notifier/channels/threema.go @@ -35,7 +35,9 @@ func NewThreemaNotifier(model *NotificationChannelConfig, t *template.Template, if model.Settings == nil { return nil, receiverInitError{Cfg: *model, Reason: "no settings supplied"} } - + if model.SecureSettings == nil { + return nil, receiverInitError{Cfg: *model, Reason: "no secure settings supplied"} + } gatewayID := model.Settings.Get("gateway_id").MustString() recipientID := model.Settings.Get("recipient_id").MustString() apiSecret := fn(context.Background(), model.SecureSettings, "api_secret", model.Settings.Get("api_secret").MustString()) diff --git a/pkg/services/ngalert/notifier/channels/threema_test.go b/pkg/services/ngalert/notifier/channels/threema_test.go index 54c9d25dc0a..84643c670cf 100644 --- a/pkg/services/ngalert/notifier/channels/threema_test.go +++ b/pkg/services/ngalert/notifier/channels/threema_test.go @@ -101,11 +101,13 @@ func TestThreemaNotifier(t *testing.T) { t.Run(c.name, func(t *testing.T) { settingsJSON, err := simplejson.NewJson([]byte(c.settings)) require.NoError(t, err) + secureSettings := make(map[string][]byte) m := &NotificationChannelConfig{ - Name: "threema_testing", - Type: "threema", - Settings: settingsJSON, + Name: "threema_testing", + Type: "threema", + Settings: settingsJSON, + SecureSettings: secureSettings, } secretsService := secretsManager.SetupTestService(t, fakes.NewFakeSecretsStore()) diff --git a/pkg/services/ngalert/notifier/channels/victorops.go b/pkg/services/ngalert/notifier/channels/victorops.go index 39d9dfaf9ad..8d655296ff6 100644 --- a/pkg/services/ngalert/notifier/channels/victorops.go +++ b/pkg/services/ngalert/notifier/channels/victorops.go @@ -28,6 +28,10 @@ const ( // NewVictoropsNotifier creates an instance of VictoropsNotifier that // handles posting notifications to Victorops REST API func NewVictoropsNotifier(model *NotificationChannelConfig, t *template.Template) (*VictoropsNotifier, error) { + if model.Settings == nil { + return nil, receiverInitError{Cfg: *model, Reason: "no settings supplied"} + } + url := model.Settings.Get("url").MustString() if url == "" { return nil, receiverInitError{Cfg: *model, Reason: "could not find victorops url property in settings"} diff --git a/pkg/services/ngalert/notifier/channels/webhook.go b/pkg/services/ngalert/notifier/channels/webhook.go index c2d2ea3f8e8..6b1f55c60b8 100644 --- a/pkg/services/ngalert/notifier/channels/webhook.go +++ b/pkg/services/ngalert/notifier/channels/webhook.go @@ -31,7 +31,10 @@ type WebhookNotifier struct { // the WebHook notifier. func NewWebHookNotifier(model *NotificationChannelConfig, t *template.Template, fn GetDecryptedValueFn) (*WebhookNotifier, error) { if model.Settings == nil { - return nil, receiverInitError{Cfg: *model, Reason: "could not find settings property"} + return nil, receiverInitError{Cfg: *model, Reason: "no settings supplied"} + } + if model.SecureSettings == nil { + return nil, receiverInitError{Cfg: *model, Reason: "no secure settings supplied"} } url := model.Settings.Get("url").MustString() if url == "" { diff --git a/pkg/services/ngalert/notifier/channels/webhook_test.go b/pkg/services/ngalert/notifier/channels/webhook_test.go index 0939a5329ee..eb49a09325b 100644 --- a/pkg/services/ngalert/notifier/channels/webhook_test.go +++ b/pkg/services/ngalert/notifier/channels/webhook_test.go @@ -182,12 +182,14 @@ func TestWebhookNotifier(t *testing.T) { t.Run(c.name, func(t *testing.T) { settingsJSON, err := simplejson.NewJson([]byte(c.settings)) require.NoError(t, err) + secureSettings := make(map[string][]byte) m := &NotificationChannelConfig{ - Name: "webhook_testing", - Type: "webhook", - Settings: settingsJSON, - OrgID: orgID, + OrgID: orgID, + Name: "webhook_testing", + Type: "webhook", + Settings: settingsJSON, + SecureSettings: secureSettings, } secretsService := secretsManager.SetupTestService(t, fakes.NewFakeSecretsStore())