Force token for #892

This commit is contained in:
the-djmaze 2023-01-31 10:49:06 +01:00
parent 977dc1e5e4
commit b1c9bebce6
4 changed files with 3 additions and 11 deletions

View file

@ -92,11 +92,8 @@ class ServiceActions
throw new Exceptions\ClientException(Notifications::InvalidInputArgument, null, 'Action unknown');
}
if ($this->oHttp->IsPost() &&
$this->Config()->Get('security', 'csrf_protection', true) &&
($_POST['XToken'] ?? '') !== Utils::GetCsrfToken())
{
throw new Exceptions\ClientException(Notifications::InvalidToken, null, 'CSRF failed');
if ($this->oHttp->IsPost() && ($_POST['XToken'] ?? '') !== Utils::GetCsrfToken()) {
throw new Exceptions\ClientException(Notifications::InvalidToken, null, 'Token mismatch');
}
if ($this->oActions instanceof ActionsAdmin && 0 === \stripos($sAction, 'Admin') && !\in_array($sAction, ['AdminLogin', 'AdminLogout'])) {