Encryption: Override Encrypt/Decrypt in util
Breaks every test that uses Encrypt or Decrypt
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
|
||||
"github.com/grafana/grafana/pkg/bus"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
)
|
||||
|
||||
@@ -77,7 +76,7 @@ func UpdatePluginSetting(cmd *models.UpdatePluginSettingCmd) error {
|
||||
return err
|
||||
}
|
||||
for key, data := range cmd.SecureJsonData {
|
||||
encryptedData, err := util.Encrypt([]byte(data), setting.SecretKey)
|
||||
encryptedData, err := util.Encrypt([]byte(data))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
|
||||
"github.com/grafana/grafana/pkg/bus"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
)
|
||||
|
||||
@@ -265,7 +264,7 @@ func decodeAndDecrypt(s string) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
decrypted, err := util.Decrypt(decoded, setting.SecretKey)
|
||||
decrypted, err := util.Decrypt(decoded)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -275,7 +274,7 @@ func decodeAndDecrypt(s string) (string, error) {
|
||||
// encryptAndEncode will encrypt a string with grafana's secretKey, and
|
||||
// then encode it with the standard bas64 encoder
|
||||
func encryptAndEncode(s string) (string, error) {
|
||||
encrypted, err := util.Encrypt([]byte(s), setting.SecretKey)
|
||||
encrypted, err := util.Encrypt([]byte(s))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user