From 3bdc9d40fa1a0b9abe8fb5ef2e5ee4d9c1d6126f Mon Sep 17 00:00:00 2001 From: briskt <3172830+briskt@users.noreply.github.com> Date: Thu, 20 Jun 2024 18:15:51 +0800 Subject: [PATCH] fix status test --- behat.yml | 6 +++--- features/bootstrap/StatusContext.php | 2 +- modules/silauth/src/Auth/Source/system/System.php | 5 ++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/behat.yml b/behat.yml index c7a0d10e..4ef546fd 100644 --- a/behat.yml +++ b/behat.yml @@ -28,6 +28,6 @@ default: # - '%paths.base%//features//Sp3Idp1Sp1Idp1Sp2Idp2.feature' # - '%paths.base%//features//WwwMetadataCept.feature' # - '%paths.base%//features//ZSp1Idp1BetaSp1Idp3.feature' -# status_features: -# paths: [ '%paths.base%//features//status.feature' ] -# contexts: [ 'StatusContext' ] + status_features: + paths: [ '%paths.base%//features//status.feature' ] + contexts: [ 'StatusContext' ] diff --git a/features/bootstrap/StatusContext.php b/features/bootstrap/StatusContext.php index a78c213a..4d8c7ab3 100644 --- a/features/bootstrap/StatusContext.php +++ b/features/bootstrap/StatusContext.php @@ -39,7 +39,7 @@ public function iRequestTheInitialLoginPageOfThisModule() 'cookies' => true, 'http_errors' => false, ]); - $response = $client->get('http://ssp-idp1.local/module.php/core/authenticate.php?as=silauth'); + $response = $client->get('http://ssp-idp1.local/module.php/admin/test/silauth'); $this->responseCode = $response->getStatusCode(); } diff --git a/modules/silauth/src/Auth/Source/system/System.php b/modules/silauth/src/Auth/Source/system/System.php index cfe11950..edeb88a3 100644 --- a/modules/silauth/src/Auth/Source/system/System.php +++ b/modules/silauth/src/Auth/Source/system/System.php @@ -29,7 +29,7 @@ protected function isDatabaseOkay(): bool FailedLoginIpAddress::getMostRecentFailedLoginFor(''); return true; } catch (Throwable $t) { - $this->logError($t->getMessage()); + $this->logError('isDatabaseOkay database check returned error: ' . $t->getMessage()); return false; } } @@ -47,6 +47,9 @@ protected function isRequiredConfigPresent(): bool */ $baseURL = $globalConfig->getString('baseurlpath', ''); $avoidsSecurityHole = (preg_match('#^https?://.*/$#D', $baseURL) === 1); + if (!$avoidsSecurityHole) { + $this->logError('isRequiredConfigPresent failed: baseurlpath (' . $baseURL . ') does not meet requirements'); + } return $avoidsSecurityHole; }