From abf5c42429edc243676d5dee40a7f658f0298464 Mon Sep 17 00:00:00 2001 From: ildyria Date: Mon, 19 Jun 2023 21:58:45 +0200 Subject: [PATCH] skip if honeypot is not enabled --- app/Http/Controllers/HoneyPotController.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/HoneyPotController.php b/app/Http/Controllers/HoneyPotController.php index 5dcf96c56aa..ca41bcfcb21 100644 --- a/app/Http/Controllers/HoneyPotController.php +++ b/app/Http/Controllers/HoneyPotController.php @@ -16,6 +16,11 @@ class HoneyPotController extends Controller { public function __invoke(string $path = ''): void { + // Check if Honey is available + if (config('honeypot.enabled', true) !== true) { + $this->throwNotFound($path); + } + /** @var array $honeypot_paths_array */ $honeypot_paths_array = config('honeypot.paths', []); @@ -31,11 +36,6 @@ public function __invoke(string $path = ''): void } } - // Check if Honey is available - if (config('honeypot.enabled', true) !== true) { - $this->throwNotFound($path); - } - // Turn the path array into a regex pattern. // We escape . and / to avoid confusions with other regex characters $honeypot_paths = '/^(' . str_replace(['.', '/'], ['\.', '\/'], implode('|', $honeypot_paths_array)) . ')/i'; @@ -81,4 +81,4 @@ public function throwTeaPot(string $path) { throw new HttpHoneyPotException($path); } -} \ No newline at end of file +}