Skip to content

Commit

Permalink
Do not use actual request on BadRequestHttpException handling
Browse files Browse the repository at this point in the history
The fact that a BadRequestHttpException is thrown implies the request is probably one of unsafe, untrustworthy or malformed.
Therefore we should not attempt to use it in any manner, given that it might contain incorrect data or cause new exceptions.
  • Loading branch information
jnoordsij committed Mar 12, 2024
1 parent a6b4895 commit a69d5e1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Illuminate/Foundation/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
use Symfony\Component\HttpFoundation\RedirectResponse as SymfonyRedirectResponse;
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
Expand Down Expand Up @@ -470,6 +471,7 @@ public function render($request, Throwable $e)
$e instanceof HttpResponseException => $e->getResponse(),
$e instanceof AuthenticationException => $this->unauthenticated($request, $e),
$e instanceof ValidationException => $this->convertValidationExceptionToResponse($e, $request),
$e instanceof BadRequestHttpException => $this->renderExceptionResponse(new \Illuminate\Http\Request(), $e),
default => $this->renderExceptionResponse($request, $e),
};
}
Expand Down

0 comments on commit a69d5e1

Please sign in to comment.