feat: Add generate session token to CsrfTokenManager

Signed-off-by: Carl Schwan <carlschwan@kde.org>
This commit is contained in:
Carl Schwan 2026-05-05 14:54:41 +02:00 committed by Ferdinand Thiessen
parent c5c3525a6e
commit e21b7d1121
3 changed files with 5 additions and 2 deletions

View file

@ -196,7 +196,7 @@ class SecurityMiddleware extends Middleware {
}
}
// CSRF check - also registers the CSRF token since the session may be closed later
Server::get(CsrfTokenManager::class)->getToken()->getEncryptedValue();
Server::get(CsrfTokenManager::class)->generateSessionToken();
if ($this->isInvalidCSRFRequired($reflectionMethod)) {
/*
* Only allow the CSRF check to fail on OCS Requests. This kind of

View file

@ -74,4 +74,8 @@ class CsrfTokenManager {
$token->getDecryptedValue()
);
}
public function generateSessionToken(): void {
$this->getToken();
}
}

View file

@ -449,7 +449,6 @@ class Util {
return htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8');
}, $value);
}
// Specify encoding for PHP<5.4
return htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8');
}