1
0
mirror of git://f0xx.org/ac/ac-be-builder synced 2026-07-29 04:18:20 +03:00

feat(builder): shared nav shell, fail notify, sanitizer wiring

Signed-off-by: Anton Afanasyeu <a.afanasieff@gmail.com>
This commit is contained in:
Anton Afanasyeu
2026-07-12 13:53:37 +02:00
parent 608f4fdb2e
commit 4200ae8f12
12 changed files with 439 additions and 32 deletions

View File

@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
/** Strip URLs, paths with secrets, and credential-like tokens from user-visible build errors. */
final class BuildErrorSanitizer {
public static function sanitize(string $message): string {
if ($message === '') {
return '';
}
$out = $message;
$out = preg_replace('#https?://[^\s\'"<>]+#i', '***', $out) ?? $out;
$out = preg_replace('#git://[^\s\'"<>]+#i', '***', $out) ?? $out;
$out = preg_replace('#ssh://[^\s\'"<>]+#i', '***', $out) ?? $out;
$out = preg_replace(
'/\b(password|passwd|pass|token|secret|api[_-]?key|bearer|authorization)\s*[:=]\s*\S+/i',
'$1=***',
$out
) ?? $out;
$out = preg_replace(
'/(?:\/[^\s]+)?\/(?:\.env|credentials(?:\.json)?|secrets?\.(?:json|ya?ml|env))[^\s]*/i',
'***',
$out
) ?? $out;
$out = preg_replace('#/var/www/[^\s\'"]+#', '***', $out) ?? $out;
$out = preg_replace('#/home/[^\s\'"]+#', '***', $out) ?? $out;
return trim(preg_replace('/\s{2,}/', ' ', $out) ?? $out);
}
}