fix(proxmox): harden console sessions and firewall rollout safety

Reduce security and reliability risk across the Proxmox extension by removing password exposure from Livewire state, hardening console auth/cookie handling, and improving sanitized error paths. Improve firewall and router performance by adding safer lazy loading, bounded pagination, cross-server compatibility guards, and lower-overhead API workflows.

Made-with: Cursor
This commit is contained in:
2026-03-28 19:34:46 -04:00
parent 9f996035db
commit 68043f0416
39 changed files with 1106 additions and 5013 deletions

View File

@@ -56,9 +56,12 @@ class CoreRouterClient
$pageCount = 1;
$hasNextLink = isset($links['next']) && !empty($links['next']);
$gotFullLimit = count($allStates) >= $stateLimit;
$maxPages = 1000; // Safety limit to prevent infinite loops (should never reach this)
$maxPages = max(1, (int) config('corerouter.max_pages', 25));
$maxStatesTotal = max($stateLimit, (int) config('corerouter.max_states_total', 5000));
$fullLimitProbeCount = 0;
$maxFullLimitProbes = max(0, (int) config('corerouter.max_full_limit_probes', 1));
while (($hasNextLink || $gotFullLimit) && $pageCount < $maxPages) {
while (($hasNextLink || ($gotFullLimit && $fullLimitProbeCount < $maxFullLimitProbes)) && $pageCount < $maxPages) {
try {
// Extract offset and limit from next URL or increment offset
$offset = count($allStates);
@@ -73,9 +76,21 @@ class CoreRouterClient
if (is_array($nextData) && !empty($nextData)) {
$allStates = array_merge($allStates, $nextData);
if (count($allStates) >= $maxStatesTotal) {
$allStates = array_slice($allStates, 0, $maxStatesTotal);
\Log::warning('Core Router API state collection capped to configured max', [
'max_states_total' => $maxStatesTotal,
'pages_fetched' => $pageCount,
]);
break;
}
$links = Arr::get($nextResponse, '_links', []);
$hasNextLink = isset($links['next']) && !empty($links['next']);
$gotFullLimit = count($nextData) >= $stateLimit;
if (!$hasNextLink && $gotFullLimit) {
$fullLimitProbeCount++;
}
$pageCount++;
// Log progress every 10 pages to track fetching
@@ -104,6 +119,7 @@ class CoreRouterClient
\Log::warning('Core Router API pagination reached safety limit', [
'pages' => $pageCount,
'total_states' => count($allStates),
'max_pages' => $maxPages,
]);
}