Add sanitized provisioning diagnostics

This commit is contained in:
Hermes Agent
2026-09-20 15:16:55 +00:00
parent d43cd767ee
commit 40cea4ca65
3 changed files with 14 additions and 2 deletions
+4 -1
View File
@@ -198,7 +198,10 @@ function pnpaas_portainer_request(string $path, string $method = 'GET', ?array $
throw new RuntimeException('Portainer ist nicht erreichbar.');
}
if ($status < 200 || ($status >= 300 && $status !== 304)) {
throw new RuntimeException('Portainer hat die Anfrage abgelehnt.');
$detail = trim(preg_replace('/\s+/', ' ', (string)$body) ?? '');
$detail = preg_replace('/("?(?:token|password|api[_-]?key|secret)"?\s*:\s*)"[^"]*"/i', '$1"[redacted]"', $detail) ?? $detail;
$detail = substr($detail, 0, 600);
throw new RuntimeException('Portainer HTTP ' . $status . ($detail !== '' ? ': ' . $detail : '.'));
}
if ($body === '' || $body === null) {
return [];