diff options
author | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-09-29 06:45:10 +0300 |
---|---|---|
committer | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-09-29 06:45:10 +0300 |
commit | 6a9fe03ff29621beced7cbab4164872cb4cd4384 (patch) | |
tree | d2b4d3df9bff103349f0c77c07558abbedbbe931 /libraries/classes/Controllers | |
parent | 000bf397a4ae33ea8334917614c70d2cbcea7546 (diff) | |
parent | add68b47e314fb74c6e6c11bafbbed6ed8c74344 (diff) |
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Diffstat (limited to 'libraries/classes/Controllers')
-rw-r--r-- | libraries/classes/Controllers/HomeController.php | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libraries/classes/Controllers/HomeController.php b/libraries/classes/Controllers/HomeController.php index 2b7a30226c..22b3990735 100644 --- a/libraries/classes/Controllers/HomeController.php +++ b/libraries/classes/Controllers/HomeController.php @@ -318,19 +318,23 @@ class HomeController extends AbstractController * Check if user does not have defined blowfish secret and it is being used. */ if (! empty($_SESSION['encryption_key'])) { - if (empty($GLOBALS['cfg']['blowfish_secret'])) { + $encryptionKeyLength = mb_strlen($GLOBALS['cfg']['blowfish_secret'], '8bit'); + if ($encryptionKeyLength < SODIUM_CRYPTO_SECRETBOX_KEYBYTES) { $this->errors[] = [ 'message' => __( - 'The configuration file now needs a secret passphrase (blowfish_secret).' + 'The configuration file needs a valid key for cookie encryption.' + . ' A temporary key was automatically generated for you.' + . ' Please refer to the [doc@cfg_blowfish_secret]documentation[/doc].' ), 'severity' => 'warning', ]; - } elseif (mb_strlen($GLOBALS['cfg']['blowfish_secret'], '8bit') !== SODIUM_CRYPTO_SECRETBOX_KEYBYTES) { + } elseif ($encryptionKeyLength > SODIUM_CRYPTO_SECRETBOX_KEYBYTES) { $this->errors[] = [ 'message' => sprintf( __( - 'The secret passphrase in configuration (blowfish_secret) is not the correct length.' - . ' It should be %d bytes long.' + 'The cookie encryption key in the configuration file is longer than necessary.' + . ' It should only be %d bytes long.' + . ' Please refer to the [doc@cfg_blowfish_secret]documentation[/doc].' ), SODIUM_CRYPTO_SECRETBOX_KEYBYTES ), |