Add authorization check for audit logs in handleRequest method
This commit is contained in:
parent
4817c15338
commit
cb5862fe94
1 changed files with 7 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace FederationServer\Methods\Audit;
|
||||
|
||||
use FederationServer\Classes\Configuration;
|
||||
use FederationServer\Classes\Managers\AuditLogManager;
|
||||
use FederationServer\Classes\RequestHandler;
|
||||
use FederationServer\Classes\Validate;
|
||||
|
@ -16,6 +17,12 @@
|
|||
*/
|
||||
public static function handleRequest(): void
|
||||
{
|
||||
$authenticatedOperator = FederationServer::getAuthenticatedOperator();
|
||||
if(!Configuration::getServerConfiguration()->isAuditLogsPublic() && $authenticatedOperator === null)
|
||||
{
|
||||
throw new RequestException('Unauthorized: Public audit logs are disabled and no operator is authenticated', 403);
|
||||
}
|
||||
|
||||
if(!preg_match('#^/audit/([a-fA-F0-9\-]{36,})$#', FederationServer::getPath(), $matches))
|
||||
{
|
||||
throw new RequestException('Bad Request: Audit UUID is required', 400);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue