diff --git a/app/Http/Middleware/BadBotBlocker.php b/app/Http/Middleware/BadBotBlocker.php index 8a275ad72f..6da2166743 100644 --- a/app/Http/Middleware/BadBotBlocker.php +++ b/app/Http/Middleware/BadBotBlocker.php @@ -1535,9 +1535,12 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface return $this->response('Not acceptable: no-ua'); } - foreach (self::BAD_ROBOTS as $robot) { - if (str_contains($ua, $robot)) { - return $this->response('Not acceptable: bad-ua'); + $allow_ua = Validator::attributes($request)->string('allow_ua', ''); + if (array_filter(explode(',', $allow_ua), static fn (string $x): bool => str_contains($ua, trim($x))) === []) { + foreach (self::BAD_ROBOTS as $robot) { + if (str_contains($ua, $robot)) { + return $this->response('Not acceptable: bad-ua'); + } } }