Skip to content

Commit

Permalink
Fix intercepting a redirect to other domain on login using // at the …
Browse files Browse the repository at this point in the history
…start of the url
  • Loading branch information
carakas committed Mar 23, 2022
1 parent 1b38e33 commit 77760a8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Backend/Modules/Authentication/Actions/Index.php
Expand Up @@ -10,6 +10,7 @@
use Backend\Core\Engine\User;
use Backend\Modules\Users\Engine\Model as BackendUsersModel;
use Common\Mailer\Message;
use SpoonFilter;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;

Expand Down Expand Up @@ -326,7 +327,10 @@ private function getAllowedModule()

private function sanitizeQueryString(string $queryString, string $default): string
{
if (!preg_match('/^\//', $queryString) or preg_match('/^\/[^a-zA-Z0-9.-_~]/', $queryString)) {
if (!preg_match('/^\//', $queryString)
|| preg_match('/^\/\//', $queryString)
|| preg_match('/^\/[^a-zA-Z0-9.-_~]/', $queryString)
) {
return $default;
}

Expand Down

0 comments on commit 77760a8

Please sign in to comment.