Only show version string in health endpoint, when user has permissions

This commit is contained in:
Jan Böhmer 2026-05-03 19:43:12 +02:00
parent bd686ed9b3
commit ce267cd69d

View file

@ -588,9 +588,16 @@ class UpdateManagerController extends AbstractController
#[Route('/health', name: 'admin_update_manager_health', methods: ['GET'])]
public function healthCheck(): JsonResponse
{
return $this->json([
//Only show version if user is logged in and has permission
$response = [
'status' => 'ok',
'version' => $this->versionManager->getVersion()->toString(),
]);
];
if ($this->isGranted('@system.show_updates')) {
$response['version'] = $this->versionManager->getVersion()->toString();
}
return $this->json($response);
}
}