soumairi /
laravel-domain-checker
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace Soumairi\DomainChecker\Http\Middleware; |
||||
| 4 | |||||
| 5 | use Closure; |
||||
| 6 | use Illuminate\Support\Facades\Log; |
||||
| 7 | use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; |
||||
|
0 ignored issues
–
show
|
|||||
| 8 | |||||
| 9 | class DomainCheckerMiddleware |
||||
| 10 | { |
||||
| 11 | /** |
||||
| 12 | * Handle an incoming request. |
||||
| 13 | * |
||||
| 14 | * @param \Illuminate\Http\Request $request |
||||
|
0 ignored issues
–
show
The type
Illuminate\Http\Request was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||
| 15 | * @param \Closure $next |
||||
| 16 | * @return mixed |
||||
| 17 | */ |
||||
| 18 | public function handle($request, Closure $next) |
||||
| 19 | { |
||||
| 20 | $allowedHosts = config('domain-checker.allowed_domains'); |
||||
|
0 ignored issues
–
show
The function
config was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 21 | $requestHost = $request->getHost(); |
||||
| 22 | |||||
| 23 | if (!app()->runningUnitTests()) { |
||||
|
0 ignored issues
–
show
The function
app was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 24 | if (!\in_array($requestHost, $allowedHosts, false)) { |
||||
| 25 | $requestInfo = [ |
||||
| 26 | 'host' => $requestHost, |
||||
| 27 | 'ip' => $request->getClientIp(), |
||||
| 28 | 'url' => $request->getRequestUri(), |
||||
| 29 | 'agent' => $request->header('User-Agent'), |
||||
| 30 | ]; |
||||
| 31 | $error_msg=config('domain-checker.error_message'); |
||||
| 32 | Log::alert('------------------------------------------Domaine Checker------------------------------------------'); |
||||
| 33 | Log::alert('access_from_unauthorized_domain'); |
||||
| 34 | Log::alert($requestInfo); |
||||
|
0 ignored issues
–
show
$requestInfo of type array is incompatible with the type string expected by parameter $message of Illuminate\Support\Facades\Log::alert().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 35 | Log::alert('---------------------------------------------------------------------------------------------------'); |
||||
| 36 | throw new AccessDeniedHttpException($error_msg); |
||||
| 37 | } |
||||
| 38 | } |
||||
| 39 | return $next($request); |
||||
| 40 | } |
||||
| 41 | } |
||||
| 42 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths