From bbbbf9ac422f1f06e60a7f509d26dc9a6e5adac0 Mon Sep 17 00:00:00 2001 From: Will Browne Date: Mon, 24 Aug 2020 16:49:10 +0200 Subject: [PATCH] Alerting: Store sensitive settings encrypted for LINE notifier (#27157) * encrypt token * update docs --- docs/sources/administration/provisioning.md | 6 ++--- pkg/services/alerting/notifiers/line.go | 26 ++++++++++++++------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/docs/sources/administration/provisioning.md b/docs/sources/administration/provisioning.md index 560d68554e3..ce359db0fd2 100644 --- a/docs/sources/administration/provisioning.md +++ b/docs/sources/administration/provisioning.md @@ -453,9 +453,9 @@ The following sections detail the supported settings and secure settings for eac #### Alert notification `LINE` -| Name | -| ----- | -| token | +| Name | Secure setting | +| ----- | - | +| token | yes | #### Alert notification `pagerduty` diff --git a/pkg/services/alerting/notifiers/line.go b/pkg/services/alerting/notifiers/line.go index e4688c8a6af..f61c9d605ea 100644 --- a/pkg/services/alerting/notifiers/line.go +++ b/pkg/services/alerting/notifiers/line.go @@ -18,13 +18,23 @@ func init() { Heading: "LINE notify settings", Factory: NewLINENotifier, OptionsTemplate: ` -
-

LINE notify settings

-
- Token - -
-
+

LINE notify settings

+
+ +
+ + +
+
+ + reset +
+
`, Options: []alerting.NotifierOption{ { @@ -44,7 +54,7 @@ const ( // NewLINENotifier is the constructor for the LINE notifier func NewLINENotifier(model *models.AlertNotification) (alerting.Notifier, error) { - token := model.Settings.Get("token").MustString() + token := model.DecryptedValue("token", model.Settings.Get("token").MustString()) if token == "" { return nil, alerting.ValidationError{Reason: "Could not find token in settings"} }