From 0affeeec137e095b224598fc34126dca13939cb2 Mon Sep 17 00:00:00 2001 From: Sebastien Monterisi Date: Thu, 23 Oct 2025 08:58:10 +0200 Subject: [PATCH 01/13] on invalid glpi (encryption) key : warnings + hide form to update glpi subscription key --- src/GLPIKey.php | 21 +++++++++++++++++++++ src/GLPINetwork.php | 25 ++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/src/GLPIKey.php b/src/GLPIKey.php index a179dc6219b..7ef89d948ed 100644 --- a/src/GLPIKey.php +++ b/src/GLPIKey.php @@ -118,6 +118,27 @@ public function keyExists() return file_exists($this->keyfile); } + /** + * Check if key is valid + * + * @return string[] + */ + public function getKeyFileReadErrors(): array + { + $errors = []; + if (!file_exists($this->keyfile)) { + $errors[] = __s('You must create a security key, use `./bin/console security:change_key` command.'); + } + if ($key = file_get_contents($this->keyfile) === false) { + $errors[] = __s("Unable to get security key file contents. Fix file permissions of {$this->keyfile}."); + } + if (strlen($key) !== SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES) { + $errors[] = __s('Invalid security key file contents. Regenerate a key using `./bin/console security:change_key` command.'); + } + + return $errors; + } + /** * Get GLPI security key used for decryptable passwords * diff --git a/src/GLPINetwork.php b/src/GLPINetwork.php index 9b69a198b33..13b6030de3d 100644 --- a/src/GLPINetwork.php +++ b/src/GLPINetwork.php @@ -58,9 +58,24 @@ public static function showForConfig() return; } - $registration_key = self::getRegistrationKey(); + // warning and no form if can't read keyfile + $glpi_key_read_errors = self::getGlpiKeyFileReadErrors(); + if(!empty($glpi_key_read_errors)) { + \Glpi\Application\View\TemplateRenderer::getInstance()->display( + '/central/messages.html.twig', + [ + 'messages' => [ + 'errors' => $glpi_key_read_errors, + ], + ] + ); + + return; + } $canedit = Config::canUpdate(); + $registration_key = self::getRegistrationKey(); + if ($canedit) { echo "
"; } @@ -372,4 +387,12 @@ public static function getOffers(bool $force_refresh = false): array return $offers; } + + /** + * @return string[] + */ + private static function getGlpiKeyFileReadErrors(): array + { + return (new GLPIKey())->getKeyFileReadErrors(); + } } From 14d722c019b1c1282fb9a6f660cb3921cb0b82ba Mon Sep 17 00:00:00 2001 From: Sebastien Monterisi Date: Thu, 23 Oct 2025 10:30:20 +0200 Subject: [PATCH 02/13] added phpunit tests --- phpunit/functional/GLPIKeyTest.php | 56 ++++++++++++++++++++++++++++++ src/GLPIKey.php | 4 ++- src/GLPINetwork.php | 2 +- 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/phpunit/functional/GLPIKeyTest.php b/phpunit/functional/GLPIKeyTest.php index c236695cd43..f62a64d179d 100644 --- a/phpunit/functional/GLPIKeyTest.php +++ b/phpunit/functional/GLPIKeyTest.php @@ -538,4 +538,60 @@ public function testIsConfigSecured() $this->assertFalse($is_myplugin_href_secured); $this->assertFalse($is_someplugin_conf_secured); } + + public function testGetKeyFileReadErrorsWithMissingFile(): void + { + // arrange : create directory structure without key file + vfsStream::setup('glpi', null, ['config' => []]); + $glpikey = new \GLPIKey(vfsStream::url('glpi/config')); + + // act + $errors = $glpikey->getKeyFileReadErrors(); + + // assert + $this->assertStringContainsString('create a security key', implode(" ", $errors)); + } + + public function testGetKeyFileReadErrorsWithUnreadableFile(): void + { + // arrange : create unreadable key file + $structure = vfsStream::setup('glpi', null, ['config' => ['glpicrypt.key' => 'unreadable file']]); + $structure->getChild('config/glpicrypt.key')->chmod(0222); + + $glpikey = new \GLPIKey(vfsStream::url('glpi/config')); + + // act + $errors = $glpikey->getKeyFileReadErrors(); + + // assert + $this->assertStringContainsString('Unable to get security key file contents', implode(" ", $errors)); + } + + public function testGetKeyFileReadErrorsWithInvalidKey(): void + { + // arrange : key file exists but has invalid contents/length + vfsStream::setup('glpi', null, ['config' => ['glpicrypt.key' => 'not a valid key']]); + $glpikey = new \GLPIKey(vfsStream::url('glpi/config')); + + // act + $errors = $glpikey->getKeyFileReadErrors(); + + // assert + $this->assertStringContainsString('Invalid security key file contents', implode(" ", $errors)); + } + + public function testGetKeyFileReadErrorsWithValidKey(): void + { + // arrange : key file exists and is valid => no errors + $valid_key = 'abcdefghijklmnopqrstuvwxyz123456'; + vfsStream::setup('glpi', null, ['config' => ['glpicrypt.key' => $valid_key]]); + + $glpikey = new \GLPIKey(vfsStream::url('glpi/config')); + + // act + $errors = $glpikey->getKeyFileReadErrors(); + + // assert + $this->assertEmpty($errors); + } } diff --git a/src/GLPIKey.php b/src/GLPIKey.php index 7ef89d948ed..2dc01a55086 100644 --- a/src/GLPIKey.php +++ b/src/GLPIKey.php @@ -128,8 +128,10 @@ public function getKeyFileReadErrors(): array $errors = []; if (!file_exists($this->keyfile)) { $errors[] = __s('You must create a security key, use `./bin/console security:change_key` command.'); + + return $errors; // return as, if file does not exist, no need to check further } - if ($key = file_get_contents($this->keyfile) === false) { + if (false === ($key = @file_get_contents($this->keyfile))) { $errors[] = __s("Unable to get security key file contents. Fix file permissions of {$this->keyfile}."); } if (strlen($key) !== SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES) { diff --git a/src/GLPINetwork.php b/src/GLPINetwork.php index 13b6030de3d..439e305c442 100644 --- a/src/GLPINetwork.php +++ b/src/GLPINetwork.php @@ -60,7 +60,7 @@ public static function showForConfig() // warning and no form if can't read keyfile $glpi_key_read_errors = self::getGlpiKeyFileReadErrors(); - if(!empty($glpi_key_read_errors)) { + if (!empty($glpi_key_read_errors)) { \Glpi\Application\View\TemplateRenderer::getInstance()->display( '/central/messages.html.twig', [ From 3c0168d6f27ea92551adafee6e74b340909c558e Mon Sep 17 00:00:00 2001 From: Sebastien Monterisi Date: Thu, 23 Oct 2025 10:43:12 +0200 Subject: [PATCH 03/13] same for SNMPCredential.php --- src/SNMPCredential.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/SNMPCredential.php b/src/SNMPCredential.php index f73ca1d63b3..766b223c478 100644 --- a/src/SNMPCredential.php +++ b/src/SNMPCredential.php @@ -113,6 +113,22 @@ public function defineTabs($options = []) public function showForm($ID, array $options = []) { + // warning and no form if can't read keyfile, + // only version 3 is impacted but it's better to always show the warning & forbid form display + $glpi_key_read_errors = self::getGlpiKeyFileReadErrors(); + if (!empty($glpi_key_read_errors)) { + \Glpi\Application\View\TemplateRenderer::getInstance()->display( + '/central/messages.html.twig', + [ + 'messages' => [ + 'errors' => $glpi_key_read_errors, + ], + ] + ); + + return false; + } + $this->initForm($ID, $options); TemplateRenderer::getInstance()->display('components/form/snmpcredential.html.twig', [ 'item' => $this, @@ -122,6 +138,14 @@ public function showForm($ID, array $options = []) return true; } + /** + * @return string[] + */ + private static function getGlpiKeyFileReadErrors(): array + { + return (new GLPIKey())->getKeyFileReadErrors(); + } + /** * Real version of SNMP * From c102e802b40cdcf7a4dfcb97d4e9da55713f89d5 Mon Sep 17 00:00:00 2001 From: Sebastien Monterisi Date: Thu, 23 Oct 2025 11:06:26 +0200 Subject: [PATCH 04/13] refacto add hasReadErrors() + tests + update usage --- phpunit/functional/GLPIKeyTest.php | 45 ++++++++++++++++++++++++++++++ src/GLPIKey.php | 20 +++++++++++++ src/GLPINetwork.php | 13 ++------- src/SNMPCredential.php | 21 ++------------ 4 files changed, 71 insertions(+), 28 deletions(-) diff --git a/phpunit/functional/GLPIKeyTest.php b/phpunit/functional/GLPIKeyTest.php index f62a64d179d..4e4027ff353 100644 --- a/phpunit/functional/GLPIKeyTest.php +++ b/phpunit/functional/GLPIKeyTest.php @@ -594,4 +594,49 @@ public function testGetKeyFileReadErrorsWithValidKey(): void // assert $this->assertEmpty($errors); } + + public function testHasKeyFileReadErrorsWithMissingFile(): void + { + // arrange : create directory structure without key file + vfsStream::setup('glpi', null, ['config' => []]); + $glpikey = new \GLPIKey(vfsStream::url('glpi/config')); + + // act + assert + $this->assertTrue($glpikey->hasReadErrors()); + } + + public function testHasKeyFileReadErrorsWithUnreadableFile(): void + { + // arrange : create unreadable key file + $structure = vfsStream::setup('glpi', null, ['config' => ['glpicrypt.key' => 'unreadable file']]); + $structure->getChild('config/glpicrypt.key')->chmod(0222); + + $glpikey = new \GLPIKey(vfsStream::url('glpi/config')); + + // act + assert + $this->assertTrue($glpikey->hasReadErrors()); + + } + + public function testHasKeyFileReadErrorsWithInvalidKey(): void + { + // arrange : key file exists but has invalid contents/length + vfsStream::setup('glpi', null, ['config' => ['glpicrypt.key' => 'not a valid key']]); + $glpikey = new \GLPIKey(vfsStream::url('glpi/config')); + + // act + assert + $this->assertTrue($glpikey->hasReadErrors()); + } + + public function testHasKeyFileReadErrorsWithValidKey(): void + { + // arrange : key file exists and is valid => no errors + $valid_key = 'abcdefghijklmnopqrstuvwxyz123456'; + vfsStream::setup('glpi', null, ['config' => ['glpicrypt.key' => $valid_key]]); + + $glpikey = new \GLPIKey(vfsStream::url('glpi/config')); + + // act + assert + $this->assertFalse($glpikey->hasReadErrors()); + } } diff --git a/src/GLPIKey.php b/src/GLPIKey.php index 2dc01a55086..44ed1fc95a1 100644 --- a/src/GLPIKey.php +++ b/src/GLPIKey.php @@ -141,6 +141,26 @@ public function getKeyFileReadErrors(): array return $errors; } + public function hasReadErrors(): bool + { + return !empty($this->getKeyFileReadErrors()); + } + + public function showReadErrors(): void + { + $glpi_key_read_errors = $this->getKeyFileReadErrors(); + if (!empty($glpi_key_read_errors)) { + \Glpi\Application\View\TemplateRenderer::getInstance()->display( + '/central/messages.html.twig', + [ + 'messages' => [ + 'errors' => $glpi_key_read_errors, + ], + ] + ); + } + } + /** * Get GLPI security key used for decryptable passwords * diff --git a/src/GLPINetwork.php b/src/GLPINetwork.php index 439e305c442..88704cd9824 100644 --- a/src/GLPINetwork.php +++ b/src/GLPINetwork.php @@ -59,16 +59,9 @@ public static function showForConfig() } // warning and no form if can't read keyfile - $glpi_key_read_errors = self::getGlpiKeyFileReadErrors(); - if (!empty($glpi_key_read_errors)) { - \Glpi\Application\View\TemplateRenderer::getInstance()->display( - '/central/messages.html.twig', - [ - 'messages' => [ - 'errors' => $glpi_key_read_errors, - ], - ] - ); + $glpi_encryption_key = new GLPIKey(); + if ($glpi_encryption_key->hasReadErrors()) { + $glpi_encryption_key->showReadErrors(); return; } diff --git a/src/SNMPCredential.php b/src/SNMPCredential.php index 766b223c478..2dc8e293522 100644 --- a/src/SNMPCredential.php +++ b/src/SNMPCredential.php @@ -115,16 +115,9 @@ public function showForm($ID, array $options = []) { // warning and no form if can't read keyfile, // only version 3 is impacted but it's better to always show the warning & forbid form display - $glpi_key_read_errors = self::getGlpiKeyFileReadErrors(); - if (!empty($glpi_key_read_errors)) { - \Glpi\Application\View\TemplateRenderer::getInstance()->display( - '/central/messages.html.twig', - [ - 'messages' => [ - 'errors' => $glpi_key_read_errors, - ], - ] - ); + $glpi_encryption_key = new GLPIKey(); + if ($glpi_encryption_key->hasReadErrors()) { + $glpi_encryption_key->showReadErrors(); return false; } @@ -138,14 +131,6 @@ public function showForm($ID, array $options = []) return true; } - /** - * @return string[] - */ - private static function getGlpiKeyFileReadErrors(): array - { - return (new GLPIKey())->getKeyFileReadErrors(); - } - /** * Real version of SNMP * From d177c54b7a5b39ead7bba097e9353fc914911d19 Mon Sep 17 00:00:00 2001 From: Sebastien Monterisi Date: Thu, 23 Oct 2025 12:24:10 +0200 Subject: [PATCH 05/13] add warning / forbid form display for AuthLDAP, MailCollector & NotificationMailingSetting --- src/AuthLDAP.php | 16 ++++++++++++++++ src/MailCollector.php | 8 ++++++++ src/NotificationMailingSetting.php | 10 ++++++++++ 3 files changed, 34 insertions(+) diff --git a/src/AuthLDAP.php b/src/AuthLDAP.php index 3a4357f59ce..363e9b9836b 100644 --- a/src/AuthLDAP.php +++ b/src/AuthLDAP.php @@ -431,6 +431,15 @@ public function showForm($ID, array $options = []) if (!Config::canUpdate()) { return false; } + + // warning and no form if can't read keyfile + $glpi_encryption_key = new GLPIKey(); + if ($glpi_encryption_key->hasReadErrors()) { + $glpi_encryption_key->showReadErrors(); + + return false; + } + if (empty($ID)) { $this->getEmpty(); if (isset($options['preconfig'])) { @@ -593,6 +602,13 @@ public function showForm($ID, array $options = []) */ public function showFormAdvancedConfig() { + // warning and no form if can't read keyfile + $glpi_encryption_key = new GLPIKey(); + if ($glpi_encryption_key->hasReadErrors()) { + $glpi_encryption_key->showReadErrors(); + + return; + } $ID = $this->getField('id'); $hidden = ''; diff --git a/src/MailCollector.php b/src/MailCollector.php index 3f6eeb9c94c..a87c041aac3 100644 --- a/src/MailCollector.php +++ b/src/MailCollector.php @@ -271,6 +271,14 @@ public function showForm($ID, array $options = []) /** @var array $CFG_GLPI */ global $CFG_GLPI; + // warning and no form if can't read keyfile + $glpi_encryption_key = new GLPIKey(); + if ($glpi_encryption_key->hasReadErrors()) { + $glpi_encryption_key->showReadErrors(); + + return false; + } + $this->initForm($ID, $options); $options['colspan'] = 1; $this->showFormHeader($options); diff --git a/src/NotificationMailingSetting.php b/src/NotificationMailingSetting.php index a8f86f7de25..72265030b30 100644 --- a/src/NotificationMailingSetting.php +++ b/src/NotificationMailingSetting.php @@ -124,6 +124,16 @@ public function showFormConfig($options = []) /** @var array $CFG_GLPI */ global $CFG_GLPI; + // warning and no form if can't read keyfile + // always display no matter what $options['display'] + // see comment at the end of this function + $glpi_encryption_key = new GLPIKey(); + if ($glpi_encryption_key->hasReadErrors()) { + $glpi_encryption_key->showReadErrors(); + + return; + } + if (!isset($options['display'])) { $options['display'] = true; } From 51e40d87151ef9632d5a6cb8be9eb874aa06f69c Mon Sep 17 00:00:00 2001 From: Sebastien Monterisi Date: Thu, 23 Oct 2025 12:31:45 +0200 Subject: [PATCH 06/13] remove useless method --- src/GLPINetwork.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/GLPINetwork.php b/src/GLPINetwork.php index 88704cd9824..412ffe96953 100644 --- a/src/GLPINetwork.php +++ b/src/GLPINetwork.php @@ -380,12 +380,4 @@ public static function getOffers(bool $force_refresh = false): array return $offers; } - - /** - * @return string[] - */ - private static function getGlpiKeyFileReadErrors(): array - { - return (new GLPIKey())->getKeyFileReadErrors(); - } } From 20f28af543ada366f80b019fb8eff49d509342ec Mon Sep 17 00:00:00 2001 From: Sebastien Monterisi Date: Mon, 27 Oct 2025 10:13:03 +0100 Subject: [PATCH 07/13] early return if files not readable. --- src/GLPIKey.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/GLPIKey.php b/src/GLPIKey.php index 44ed1fc95a1..8b53e9a1841 100644 --- a/src/GLPIKey.php +++ b/src/GLPIKey.php @@ -129,10 +129,12 @@ public function getKeyFileReadErrors(): array if (!file_exists($this->keyfile)) { $errors[] = __s('You must create a security key, use `./bin/console security:change_key` command.'); - return $errors; // return as, if file does not exist, no need to check further + return $errors; // early return, as, if file does not exist, no need to check further } if (false === ($key = @file_get_contents($this->keyfile))) { - $errors[] = __s("Unable to get security key file contents. Fix file permissions of {$this->keyfile}."); + $errors[] = __s("Unable to get security key file contents. Fix file permissions of $this->keyfile."); + + return $errors; // early return, as, if file does not exist, no need to check further } if (strlen($key) !== SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES) { $errors[] = __s('Invalid security key file contents. Regenerate a key using `./bin/console security:change_key` command.'); From b2c00b059dfe1a1f2412271021d2908a6a603cdc Mon Sep 17 00:00:00 2001 From: Sebastien Monterisi Date: Mon, 27 Oct 2025 11:06:28 +0100 Subject: [PATCH 08/13] Show cryptfile error on Central page/tab --- src/Central.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Central.php b/src/Central.php index e9180a3b11a..22000aeca0f 100644 --- a/src/Central.php +++ b/src/Central.php @@ -512,6 +512,9 @@ private static function getMessages(): array . sprintf(__('Run the "%1$s" command to migrate them.'), 'php bin/console migration:unsigned_keys'); } + // encrypt/decrypt key problems + $messages['errors'] = (new GLPIKey())->getKeyFileReadErrors(); + $security_requirements = [ new PhpSupportedVersion(), new SafeDocumentRoot(), From 46b4a7e2daa974b6a566de389fc4185d1c86c32d Mon Sep 17 00:00:00 2001 From: Sebastien Monterisi Date: Mon, 27 Oct 2025 11:07:07 +0100 Subject: [PATCH 09/13] static call of \GLPINetwork::showForConfig() --- src/GLPINetwork.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/GLPINetwork.php b/src/GLPINetwork.php index 412ffe96953..de10156d779 100644 --- a/src/GLPINetwork.php +++ b/src/GLPINetwork.php @@ -46,8 +46,7 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) { if ($item->getType() == 'Config') { - $glpiNetwork = new self(); - $glpiNetwork->showForConfig(); + self::showForConfig(); } return true; } From 285654357405d6bb6ee4889bfd0edc36f806a7f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Monterisi?= Date: Mon, 27 Oct 2025 14:52:07 +0100 Subject: [PATCH 10/13] Apply suggestion from @cedric-anne MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cédric Anne --- src/GLPIKey.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GLPIKey.php b/src/GLPIKey.php index 8b53e9a1841..dd9c5f1b146 100644 --- a/src/GLPIKey.php +++ b/src/GLPIKey.php @@ -137,7 +137,7 @@ public function getKeyFileReadErrors(): array return $errors; // early return, as, if file does not exist, no need to check further } if (strlen($key) !== SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES) { - $errors[] = __s('Invalid security key file contents. Regenerate a key using `./bin/console security:change_key` command.'); + $errors[] = sprintf(__s('Invalid security key file contents. You have to run the "%s" command to regenerate a key.'), 'php bin/console security:change_key'); } return $errors; From cad56959e164e3d25f894ecad61936ff054c6c93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Monterisi?= Date: Mon, 27 Oct 2025 14:52:46 +0100 Subject: [PATCH 11/13] Apply suggestion from @cedric-anne MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cédric Anne --- src/GLPIKey.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GLPIKey.php b/src/GLPIKey.php index dd9c5f1b146..62128d7e701 100644 --- a/src/GLPIKey.php +++ b/src/GLPIKey.php @@ -132,7 +132,7 @@ public function getKeyFileReadErrors(): array return $errors; // early return, as, if file does not exist, no need to check further } if (false === ($key = @file_get_contents($this->keyfile))) { - $errors[] = __s("Unable to get security key file contents. Fix file permissions of $this->keyfile."); + $errors[] = sprintf(__s("Unable to get security key file contents. Fix file permissions of %s."), $this->keyfile); return $errors; // early return, as, if file does not exist, no need to check further } From 030446795bccf8e8774d5bfad655e61b3903a284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Monterisi?= Date: Mon, 27 Oct 2025 14:53:02 +0100 Subject: [PATCH 12/13] Apply suggestion from @cedric-anne MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cédric Anne --- src/GLPIKey.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GLPIKey.php b/src/GLPIKey.php index 62128d7e701..26261c38f0f 100644 --- a/src/GLPIKey.php +++ b/src/GLPIKey.php @@ -127,7 +127,7 @@ public function getKeyFileReadErrors(): array { $errors = []; if (!file_exists($this->keyfile)) { - $errors[] = __s('You must create a security key, use `./bin/console security:change_key` command.'); + $errors[] = sprintf(__s('The security key file does not exist. You have to run the "%s" command to generate a key.'), 'php bin/console security:change_key'); return $errors; // early return, as, if file does not exist, no need to check further } From 8288160aa2c50828dec2455a14afb8ae7417a667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Anne?= Date: Wed, 29 Oct 2025 10:40:16 +0100 Subject: [PATCH 13/13] fix tests --- phpunit/functional/GLPIKeyTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpunit/functional/GLPIKeyTest.php b/phpunit/functional/GLPIKeyTest.php index 4e4027ff353..266beca3578 100644 --- a/phpunit/functional/GLPIKeyTest.php +++ b/phpunit/functional/GLPIKeyTest.php @@ -549,7 +549,7 @@ public function testGetKeyFileReadErrorsWithMissingFile(): void $errors = $glpikey->getKeyFileReadErrors(); // assert - $this->assertStringContainsString('create a security key', implode(" ", $errors)); + $this->assertStringContainsString('The security key file does not exist.', implode(" ", $errors)); } public function testGetKeyFileReadErrorsWithUnreadableFile(): void @@ -564,7 +564,7 @@ public function testGetKeyFileReadErrorsWithUnreadableFile(): void $errors = $glpikey->getKeyFileReadErrors(); // assert - $this->assertStringContainsString('Unable to get security key file contents', implode(" ", $errors)); + $this->assertStringContainsString('Unable to get security key file contents.', implode(" ", $errors)); } public function testGetKeyFileReadErrorsWithInvalidKey(): void @@ -577,7 +577,7 @@ public function testGetKeyFileReadErrorsWithInvalidKey(): void $errors = $glpikey->getKeyFileReadErrors(); // assert - $this->assertStringContainsString('Invalid security key file contents', implode(" ", $errors)); + $this->assertStringContainsString('Invalid security key file contents.', implode(" ", $errors)); } public function testGetKeyFileReadErrorsWithValidKey(): void