Skip to content

Commit

Permalink
skip if honeypot is not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ildyria committed Jun 19, 2023
1 parent ebd6fef commit abf5c42
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/Http/Controllers/HoneyPotController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<int,string> $honeypot_paths_array */
$honeypot_paths_array = config('honeypot.paths', []);

Expand All @@ -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';
Expand Down Expand Up @@ -81,4 +81,4 @@ public function throwTeaPot(string $path)
{
throw new HttpHoneyPotException($path);
}
}
}

0 comments on commit abf5c42

Please sign in to comment.