Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Fix local infrastructure proxy bypass

rcourtman376b7b9b0733
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index 38e3c376a1..2968325cb2 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -333,6 +333,10 @@ regression protection.
Workloads source-health messaging must derive from the canonical
`/api/connections` ledger through
`frontend-modern/src/components/Workloads/workloadInventorySourceIssues.ts`.
+ Platform-owned embedded Workloads surfaces must scope those source-health
+ issues to the forced platform before rendering an empty inventory state, and
+ the remediation action must route to the canonical infrastructure workspace
+ without adding per-source fetches or route-local source probes.
Connection-ledger refreshes on the Workloads page are steady-state health
probes, not route-loading authority: after the Workloads shell has mounted,
those refreshes must retain the last rendered table state and must not trip
diff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.md
index c750fb711d..ca51de46c8 100644
--- a/docs/release-control/v6/internal/subsystems/security-privacy.md
+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md
@@ -757,6 +757,12 @@ fingerprint runtime clients. `pkg/tlsutil/fingerprint.go` may support
certificate-fingerprint capture and verification for self-signed deployments,
but every mode must still set an explicit minimum TLS version instead of
silently inheriting whatever older protocol floor the host runtime would allow.
+The same shared client transport must not leak local infrastructure API
+requests through inherited environment proxies: loopback, private, link-local,
+CGNAT/Tailscale, mDNS/local, and single-label infrastructure hosts are direct
+connections by default, while public endpoints may still honor the operator's
+proxy environment. Proxy-bypass changes for this path require targeted TLS
+client tests plus adjacent Proxmox, PBS, and PMG client coverage.
That same rule also applies inside shipped security guidance itself:
`SECURITY.md` and the synced `frontend-modern/public/docs/SECURITY.md` copy may
not bounce the operator back to GitHub `main` for section references that the
diff --git a/frontend-modern/src/components/Workloads/WorkloadsSurface.tsx b/frontend-modern/src/components/Workloads/WorkloadsSurface.tsx
index 5ed53d042f..4113a18bef 100644
--- a/frontend-modern/src/components/Workloads/WorkloadsSurface.tsx
+++ b/frontend-modern/src/components/Workloads/WorkloadsSurface.tsx
@@ -1,10 +1,13 @@
-import { Show } from 'solid-js';
+import { For, Show, createMemo } from 'solid-js';
+import { buildInfrastructureWorkspacePath } from '@/components/Settings/infrastructureWorkspaceModel';
import { EmptyState } from '@/components/shared/EmptyState';
+import { ButtonLink } from '@/components/shared/Button';
import { TableCard } from '@/components/shared/TableCard';
import { WorkloadsFilter } from './WorkloadsFilter';
import { DEFAULT_WORKLOADS_VIEW_MODE, hasActiveWorkloadsFilters } from './workloadsFilterModel';
import { WorkloadsTable } from './WorkloadsTable';
+import type { WorkloadInventorySourceIssue } from './workloadInventorySourceIssues';
import {
useWorkloadsState,
type WorkloadsState,
@@ -18,8 +21,60 @@ interface WorkloadsSurfaceComponentProps extends WorkloadsSurfaceProps {
state?: WorkloadsState;
}
+type TableOnlyEmptyState = {
+ title: string;
+ description: string;
+ actionLabel?: string;
+};
+
+const PLATFORM_ISSUE_TYPES: Record<string, readonly WorkloadInventorySourceIssue['type'][]> = {
+ docker: ['docker'],
+ kubernetes: ['kubernetes'],
+ 'proxmox-pve': ['pve'],
+ 'vmware-vsphere': ['vmware'],
+};
+
+function WorkloadInventoryIssueList(props: { issues: readonly WorkloadInventorySourceIssue[] }) {
+ return (
+ <div
+ class="w-full max-w-2xl border-t border-border pt-3 text-left"
+ data-testid="workload-inventory-source-issues"
+ >
+ <ul class="divide-y divide-border">
+ <For each={props.issues}>
+ {(issue) => (
+ <li class="py-3">
+ <div class="flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between">
+ <div class="min-w-0 space-y-1">
+ <p class="text-sm font-semibold text-base-content">
+ {issue.stateLabel}: {issue.name}
+ </p>
+ <p class="text-sm leading-6 text-muted">{issue.description}</p>
+ <Show when={issue.detail}>
+ <p class="text-xs leading-5 text-muted">{issue.detail}</p>
+ </Show>
+ </div>
+ <span class="shrink-0 rounded bg-amber-50 px-2 py-0.5 text-xs font-medium text-amber-700 dark:bg-amber-950 dark:text-amber-200">
+ {issue.coverageLabel}
+ </span>
+ </div>
+ </li>
+ )}
+ </For>
+ </ul>
+ </div>
+ );
+}
+
export function WorkloadsSurface(props: WorkloadsSurfaceComponentProps) {
const state = props.state ?? useWorkloadsState(props);
+ const visibleInventoryIssues = createMemo(() => {
+ const issues = state.workloadInventoryIssues?.() ?? [];
+ const forcedPlatform = props.forcedPlatform?.trim().toLowerCase();
+ const platformIssueTypes = forcedPlatform ? PLATFORM_ISSUE_TYPES[forcedPlatform] : undefined;
+ if (!platformIssueTypes) return issues;
+ return issues.filter((issue) => platformIssueTypes.includes(issue.type));
+ });
const tableOnlyFiltersActive = () =>
hasActiveWorkloadsFilters({
search: state.search(),
@@ -30,17 +85,26 @@ export function WorkloadsSurface(props: WorkloadsSurfaceComponentProps) {
namespaceFilterValue: state.namespaceFilterConfig()?.value,
containerRuntimeFilterValue: state.containerRuntimeFilterConfig()?.value,
});
- const tableOnlyEmptyState = () => {
+ const tableOnlyEmptyState = createMemo<TableOnlyEmptyState>(() => {
if (tableOnlyFiltersActive()) {
return state.workloadsGuestsEmptyState();
}
+ if (visibleInventoryIssues().length > 0) {
+ return state.workloadsNoInventoryState?.() ?? {
+ title: 'No workload inventory available',
+ description:
+ 'Pulse has infrastructure sources, but no VM, container, or pod inventory is available right now.',
+ actionLabel: 'Review infrastructure sources',
+ };
+ }
+
return {
title: props.emptyStateTitle ?? 'No workloads',
description:
props.emptyStateDescription ?? 'Workloads appear here when inventory is available.',
};
- };
+ });
return (
<div ref={state.setClearSurfaceRootRef} class="space-y-3" data-testid="workloads-page">
@@ -159,6 +223,24 @@ export function WorkloadsSurface(props: WorkloadsSurfaceComponentProps) {
<EmptyState
title={tableOnlyEmptyState().title}
description={tableOnlyEmptyState().description}
+ tone={visibleInventoryIssues().length > 0 ? 'warning' : 'default'}
+ align={visibleInventoryIssues().length > 0 ? 'left' : 'center'}
+ actions={
+ <>
+ <Show when={visibleInventoryIssues().length > 0}>
+ <WorkloadInventoryIssueList issues={visibleInventoryIssues()} />
+ </Show>
+ <Show when={tableOnlyEmptyState().actionLabel}>
+ <ButtonLink
+ href={buildInfrastructureWorkspacePath()}
+ variant="secondary"
+ size="sm"
+ >
+ {tableOnlyEmptyState().actionLabel}
+ </ButtonLink>
+ </Show>
+ </>
+ }
/>
</div>
</TableCard>
diff --git a/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx b/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx
index ce37fc689a..6027d3d2d4 100644
--- a/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx
+++ b/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx
@@ -1,6 +1,7 @@
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { fireEvent, render, screen, waitFor } from '@solidjs/testing-library';
import { createSignal, onCleanup, onMount } from 'solid-js';
+import { Route, Router } from '@solidjs/router';
import type { Resource } from '@/types/resource';
import { WorkloadsSurface } from '../WorkloadsSurface';
import workloadsSource from '../WorkloadsSurface.tsx?raw';
@@ -67,6 +68,7 @@ import {
import { getKubernetesContextKey } from '../workloadTopology';
import { filterResources } from '@/components/Infrastructure/infrastructureSelectors';
import { getCanonicalWorkloadId, normalizeWorkloadViewModeParam } from '@/utils/workloads';
+import { resetCreateNonSuspendingQueryCacheForTest } from '@/hooks/createNonSuspendingQuery';
// Stub ResizeObserver for jsdom
if (typeof globalThis.ResizeObserver === 'undefined') {
@@ -496,6 +498,7 @@ describe('Workloads performance contract', () => {
navigateSpy.mockReset();
connectionsApiMocks.list.mockReset();
connectionsApiMocks.list.mockResolvedValue({ connections: [], systems: [] });
+ resetCreateNonSuspendingQueryCacheForTest();
guestRowMountCount = 0;
guestRowUnmountCount = 0;
wsConnected = true;
@@ -556,6 +559,100 @@ describe('Workloads performance contract', () => {
expect(document.body).not.toHaveTextContent('Loading...');
});
+ it('surfaces blocked Proxmox inventory sources when the platform workloads table is empty', () => {
+ render(() => (
+ <Router>
+ <Route
+ path="/"
+ component={() => (
+ <WorkloadsSurface
+ vms={[]}
+ containers={[]}
+ nodes={[]}
+ useWorkloads
+ forcedPlatform="proxmox-pve"
+ emptyStateTitle="No Proxmox workloads"
+ emptyStateDescription="Proxmox VMs and LXCs appear here when inventory is available."
+ state={
+ {
+ setClearSurfaceRootRef: vi.fn(),
+ kioskMode: () => false,
+ surfaceConnected: () => true,
+ surfaceInitialDataReceived: () => true,
+ allGuests: () => [],
+ filteredGuests: () => [],
+ search: () => '',
+ viewMode: () => 'all',
+ statusMode: () => 'all',
+ hostFilterConfig: () => undefined,
+ platformFilterConfig: () => undefined,
+ namespaceFilterConfig: () => undefined,
+ containerRuntimeFilterConfig: () => undefined,
+ workloadsGuestsEmptyState: () => ({
+ title: 'No guests found',
+ description: 'No guests match your current filters',
+ }),
+ workloadsNoInventoryState: () => ({
+ title: 'No workload inventory available',
+ description:
+ 'Pulse has infrastructure sources, but no VM, container, or pod inventory is available right now. Review source credentials, permissions, and collection status in Settings → Infrastructure.',
+ actionLabel: 'Review infrastructure sources',
+ }),
+ workloadInventoryIssues: () => [
+ {
+ id: 'pve:delly',
+ name: 'delly',
+ type: 'pve',
+ typeLabel: 'Proxmox VE',
+ state: 'unreachable',
+ stateLabel: 'Source unreachable',
+ coverageLabel: 'VMs and containers',
+ description:
+ 'Pulse has VMs and containers enabled for delly, but the Proxmox VE API is unreachable.',
+ detail:
+ 'Connection blocked. The request was blocked before Pulse could read inventory. Check proxy, firewall, or network policy settings.',
+ },
+ {
+ id: 'docker:tower',
+ name: 'Tower',
+ type: 'docker',
+ typeLabel: 'Docker',
+ state: 'unreachable',
+ stateLabel: 'Source unreachable',
+ coverageLabel: 'containers',
+ description:
+ 'Pulse has containers enabled for Tower, but the Docker API is unreachable.',
+ },
+ ],
+ } as any
+ }
+ />
+ )}
+ />
+ </Router>
+ ));
+
+ expect(screen.getByTestId('workload-inventory-source-issues')).toBeInTheDocument();
+ expect(screen.getByText('No workload inventory available')).toBeInTheDocument();
+ expect(screen.queryByText('No Proxmox workloads')).not.toBeInTheDocument();
+ expect(screen.getByText('Source unreachable: delly')).toBeInTheDocument();
+ expect(screen.queryByText('Source unreachable: Tower')).not.toBeInTheDocument();
+ expect(
+ screen.getByText(
+ 'Pulse has VMs and containers enabled for delly, but the Proxmox VE API is unreachable.',
+ ),
+ ).toBeInTheDocument();
+ expect(
+ screen.getByText(
+ 'Connection blocked. The request was blocked before Pulse could read inventory. Check proxy, firewall, or network policy settings.',
+ ),
+ ).toBeInTheDocument();
+ expect(screen.getByRole('link', { name: 'Review infrastructure sources' })).toHaveAttribute(
+ 'href',
+ '/settings/infrastructure',
+ );
+ });
+
it('opens workload row drawers inline without route navigation', async () => {
mockLocationSearch = '?type=all&agent=docker-main';
const routeSearchBeforeOpen = mockLocationSearch;
diff --git a/frontend-modern/src/components/Workloads/workloadInventorySourceIssues.ts b/frontend-modern/src/components/Workloads/workloadInventorySourceIssues.ts
index 2f5a4d67e5..96707aa462 100644
--- a/frontend-modern/src/components/Workloads/workloadInventorySourceIssues.ts
+++ b/frontend-modern/src/components/Workloads/workloadInventorySourceIssues.ts
@@ -4,6 +4,7 @@ import { formatConnectionErrorMessage } from '@/utils/connectionErrorPresentatio
export interface WorkloadInventorySourceIssue {
id: string;
name: string;
+ type: ConnectionType;
typeLabel: string;
state: ConnectionState;
stateLabel: string;
@@ -150,6 +151,7 @@ export const buildWorkloadInventorySourceIssues = (
return {
id: connection.id,
name: connection.name,
+ type: connection.type,
typeLabel,
state: connection.state,
stateLabel: stateLabelFor(connection),
diff --git a/frontend-modern/src/utils/__tests__/connectionErrorPresentation.test.ts b/frontend-modern/src/utils/__tests__/connectionErrorPresentation.test.ts
index 00e1b0ed6d..79c682d3c3 100644
--- a/frontend-modern/src/utils/__tests__/connectionErrorPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/connectionErrorPresentation.test.ts
@@ -58,6 +58,14 @@ describe('humanizeConnectionError', () => {
expect(result?.headline).toBe('Permission denied');
});
+ it('classifies access violations as blocked connections', () => {
+ const result = humanizeConnectionError(
+ 'poll_nodes failed on delly: Get "https://delly:8006/api2/json/nodes": Access violation',
+ );
+ expect(result?.headline).toBe('Connection blocked');
+ expect(result?.hint).toMatch(/proxy/i);
+ });
+
it('falls back to a cleaned message for unknown errors', () => {
const result = humanizeConnectionError(
'poll_nodes failed on delly: Get "https://example.com/foo": something genuinely novel',
diff --git a/frontend-modern/src/utils/connectionErrorPresentation.ts b/frontend-modern/src/utils/connectionErrorPresentation.ts
index c27bbae7a9..20a40dfcc1 100644
--- a/frontend-modern/src/utils/connectionErrorPresentation.ts
+++ b/frontend-modern/src/utils/connectionErrorPresentation.ts
@@ -72,6 +72,11 @@ const HUMANIZED_PATTERNS: { match: RegExp; headline: string; hint: string | null
headline: 'Authentication failed',
hint: AUTH_HINT,
},
+ {
+ match: /access violation/i,
+ headline: 'Connection blocked',
+ hint: 'The request was blocked before Pulse could read inventory. Check proxy, firewall, or network policy settings.',
+ },
{
match: /\b403\b|forbidden|permission denied/i,
headline: 'Permission denied',
diff --git a/pkg/tlsutil/fingerprint.go b/pkg/tlsutil/fingerprint.go
index 24e3453b43..39d9088d34 100644
--- a/pkg/tlsutil/fingerprint.go
+++ b/pkg/tlsutil/fingerprint.go
@@ -116,6 +116,45 @@ func FingerprintVerifier(fingerprint string) *tls.Config {
}
}
+func shouldBypassProxyForTargetHost(host string) bool {
+ normalized := strings.Trim(strings.ToLower(strings.TrimSpace(host)), "[]")
+ if normalized == "" {
+ return false
+ }
+
+ if normalized == "localhost" ||
+ strings.HasSuffix(normalized, ".localhost") ||
+ strings.HasSuffix(normalized, ".local") {
+ return true
+ }
+
+ if ip := net.ParseIP(normalized); ip != nil {
+ return ip.IsLoopback() ||
+ ip.IsPrivate() ||
+ ip.IsLinkLocalUnicast() ||
+ ip.IsLinkLocalMulticast() ||
+ ip.IsUnspecified() ||
+ isCarrierGradeNAT(ip)
+ }
+
+ return !strings.Contains(normalized, ".")
+}
+
+func isCarrierGradeNAT(ip net.IP) bool {
+ ip4 := ip.To4()
+ if ip4 == nil {
+ return false
+ }
+ return ip4[0] == 100 && ip4[1] >= 64 && ip4[1] <= 127
+}
+
+func proxyFromEnvironmentBypassingLocalInfrastructure(req *http.Request) (*url.URL, error) {
+ if req != nil && req.URL != nil && shouldBypassProxyForTargetHost(req.URL.Hostname()) {
+ return nil, nil
+ }
+ return http.ProxyFromEnvironment(req)
+}
+
// CreateHTTPClient creates an HTTP client with appropriate TLS configuration
func CreateHTTPClient(verifySSL bool, fingerprint string) *http.Client {
return CreateHTTPClientWithTimeout(verifySSL, fingerprint, 60*time.Second)
@@ -124,7 +163,7 @@ func CreateHTTPClient(verifySSL bool, fingerprint string) *http.Client {
// CreateHTTPClientWithTimeout creates an HTTP client with appropriate TLS configuration and custom timeout
func CreateHTTPClientWithTimeout(verifySSL bool, fingerprint string, timeout time.Duration) *http.Client {
transport := &http.Transport{
- Proxy: http.ProxyFromEnvironment,
+ Proxy: proxyFromEnvironmentBypassingLocalInfrastructure,
// Performance optimizations for concurrent requests
MaxIdleConns: 100, // Increase from default 2
MaxIdleConnsPerHost: 20, // Increase from default 2
diff --git a/pkg/tlsutil/tlsutil_test.go b/pkg/tlsutil/tlsutil_test.go
index 2a5f7dc1fb..72511ca861 100644
--- a/pkg/tlsutil/tlsutil_test.go
+++ b/pkg/tlsutil/tlsutil_test.go
@@ -5,6 +5,7 @@ import (
"crypto/x509"
"encoding/hex"
"net/http"
+ "net/url"
"strings"
"testing"
"time"
@@ -252,6 +253,52 @@ func TestCreateHTTPClient_TransportSettings(t *testing.T) {
}
}
+func TestShouldBypassProxyForTargetHost(t *testing.T) {
+ tests := []struct {
+ name string
+ host string
+ want bool
+ }{
+ {name: "single label Proxmox host", host: "delly", want: true},
+ {name: "localhost", host: "localhost", want: true},
+ {name: "mDNS local", host: "pve.local", want: true},
+ {name: "loopback IPv4", host: "127.0.0.1", want: true},
+ {name: "loopback IPv6", host: "::1", want: true},
+ {name: "RFC1918 IPv4", host: "192.168.0.5", want: true},
+ {name: "Tailscale CGNAT IPv4", host: "100.127.165.127", want: true},
+ {name: "public IPv4", host: "203.0.113.10", want: false},
+ {name: "public DNS name", host: "pve.example.com", want: false},
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := shouldBypassProxyForTargetHost(tt.host); got != tt.want {
+ t.Fatalf("shouldBypassProxyForTargetHost(%q) = %v, want %v", tt.host, got, tt.want)
+ }
+ })
+ }
+}
+
+func TestProxyFromEnvironmentBypassingLocalInfrastructure(t *testing.T) {
+ t.Setenv("HTTP_PROXY", "http://proxy.example:8080")
+ t.Setenv("HTTPS_PROXY", "http://proxy.example:8080")
+ t.Setenv("NO_PROXY", "")
+
+ localReq := &http.Request{URL: &url.URL{Scheme: "https", Host: "192.168.0.5:8006"}}
+ if proxyURL, err := proxyFromEnvironmentBypassingLocalInfrastructure(localReq); err != nil || proxyURL != nil {
+ t.Fatalf("local proxy = %v, err = %v; want direct", proxyURL, err)
+ }
+
+ publicReq := &http.Request{URL: &url.URL{Scheme: "https", Host: "pve.example.com:8006"}}
+ proxyURL, err := proxyFromEnvironmentBypassingLocalInfrastructure(publicReq)
+ if err != nil {
+ t.Fatalf("public proxy lookup failed: %v", err)
+ }
+ if proxyURL == nil || proxyURL.String() != "http://proxy.example:8080" {
+ t.Fatalf("public proxy = %v, want http://proxy.example:8080", proxyURL)
+ }
+}
+
func TestFingerprintVerifier_IgnoresVerifiedChains(t *testing.T) {
mockCert := []byte("test certificate")
fingerprint := sha256.Sum256(mockCert)