Encryption: Override Encrypt/Decrypt in util

Breaks every test that uses Encrypt or Decrypt
This commit is contained in:
Emil Tullstedt
2020-10-14 15:53:49 +02:00
parent 1ff6fa9424
commit 84669d2213
11 changed files with 146 additions and 161 deletions
+2 -2
View File
@@ -279,12 +279,12 @@ func tryGetEncryptedCookie(ctx *models.ReqContext, cookieName string) (string, b
return "", false
}
decryptedError, err := util.Decrypt(decoded, setting.SecretKey)
decryptedError, err := util.Decrypt(decoded)
return string(decryptedError), err == nil
}
func (hs *HTTPServer) trySetEncryptedCookie(ctx *models.ReqContext, cookieName string, value string, maxAge int) error {
encryptedError, err := util.Encrypt([]byte(value), setting.SecretKey)
encryptedError, err := util.Encrypt([]byte(value))
if err != nil {
return err
}
+1 -1
View File
@@ -109,7 +109,7 @@ func TestLoginErrorCookieApiEndpoint(t *testing.T) {
setting.OAuthAutoLogin = true
oauthError := errors.New("User not a member of one of the required organizations")
encryptedError, _ := util.Encrypt([]byte(oauthError.Error()), setting.SecretKey)
encryptedError, _ := util.Encrypt([]byte(oauthError.Error()))
expCookiePath := "/"
if len(setting.AppSubUrl) > 0 {
expCookiePath = setting.AppSubUrl