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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
fix(settings): test edited TLS with saved credentials
rcourtman02ee3a2b1d7c
diff --git a/docs/API.md b/docs/API.mdindex a14a01366d..01ae152d68 100644--- a/docs/API.md+++ b/docs/API.md@@ -746,6 +746,13 @@ delete and re-add a connection to diagnose missing readings or identity mixing.Uses the saved connection for a live test. It is not a passive read of itslast result or a guarantee that ordinary collection recovered.+An optional JSON body can override `verifySSL` and `fingerprint` for this test+without changing the saved connection or credentials. Omitted fields keep their+saved values. Send `false` to disable CA verification or `""` to clear the saved+fingerprint for the test. A nonempty fingerprint remains enforced regardless of+`verifySSL`. Empty-body requests keep the saved TLS settings. For example,+`{"verifySSL":true,"fingerprint":"<SHA-256 fingerprint>"}` tests an edited pin.+### Refresh Cluster Nodes`POST /api/config/nodes/{id}/refresh-cluster` (admin, `settings:write`)diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex 61fd3e74e8..224806740b 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -9888,3 +9888,21 @@ query, resource, tenant, credential or action authority. The observer receivesonly a successful-read marker after serialization/write, and existing APIentitlement checks remain before that boundary. Read semantics remain ownedby api-contracts and telemetry retention/disclosure by security-privacy.++### Connection edit tests retain credentials and use draft TLS (16 October 2026)++The shared node modal sends its current SSL verification flag and fingerprint+when testing with retained PVE, PBS or PMG credentials. It uses the saved-node+probe endpoint so stored secrets do not need to be returned to the browser.+Testing does not save the edits. Replacing credentials continues to use the+provided-configuration probe with the edited TLS settings.++`useNodeModalState.connectionTest.test.ts` covers retained and replaced credentials,+edited pins and clearing a pin. `frontend-modern/src/api/__tests__/nodes.test.ts`+is the direct shared transport proof. The existing node setup Settings proof+routes remain required for the modal surface.++The shared footer stacks its action groups on narrow screens and wraps controls+within each group. Delete, Test, Pause, Cancel and Save must remain visible and+keyboard reachable without horizontal scrolling. Desktop groups retain their+existing ordering. Browser proof covers both narrow and desktop viewports.diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex e466e952bb..500c51a211 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -12276,3 +12276,20 @@ HEAD and mock responses cannot increment the tally. Mock and live cache keysare separated. The optional observer receives no request or content.`history_activity_test.go` and `telemetry_history_reads_test.go` exercise thisboundary. Schema v19 count semantics and retention belong to security-privacy.++### Saved-node connection tests use draft TLS settings (16 October 2026)++`POST /api/config/nodes/{id}/test` accepts an optional JSON body containing+`verifySSL` and `fingerprint` for PVE, PBS and PMG. Omission retains the saved+value, `false` disables CA verification, and an empty fingerprint clears the+saved pin for that probe. An empty body remains compatible with existing+callers. The bounded decoder rejects malformed bodies and unknown fields.+The endpoint retains its existing administrator and settings-write authority.+Credentials are read server-side, and overrides affect only the temporary+client. A test must not save configuration or alter runtime connection health.+This is neutral to storage-recovery because no persistence or recovery path changes.++`config_handlers_connection_test.go` exercises actual TLS probes for all three+platforms, saved credentials, omitted/cleared settings and unchanged configuration+and health. `frontend-modern/src/api/__tests__/nodes.test.ts` binds the optional+body to the saved-node route, including explicit false and empty values.diff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.jsonindex 39bbd1a60d..40222a1441 100644--- a/docs/release-control/v6/internal/subsystems/registry.json+++ b/docs/release-control/v6/internal/subsystems/registry.json@@ -1826,6 +1826,7 @@"exact_files": ["frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx","frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts",+ "frontend-modern/src/components/Settings/__tests__/useNodeModalState.connectionTest.test.ts","frontend-modern/src/utils/__tests__/nodeModalPresentation.test.ts"]},@@ -3260,6 +3261,7 @@"internal/api/audit_handlers_test.go","internal/api/availability_handlers_test.go","internal/api/chartapi/history_activity_test.go",+ "internal/api/configapi/config_handlers_connection_test.go","internal/api/contract_test.go","internal/api/docker_agents_report_size_test.go","internal/api/docker_container_action_executor_test.go",diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex d77e61520e..5de56989cb 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -6941,3 +6941,13 @@ query, resource, tenant, credential or action authority. The observer receivesonly a successful-read marker after serialization/write, and existing APIentitlement checks remain before that boundary. Read semantics remain ownedby api-contracts and telemetry retention/disclosure by security-privacy.++### Saved-credential TLS probes leave storage and recovery unchanged (16 October 2026)++`internal/api/configapi/config_node_handlers.go` accepts draft SSL verification+and fingerprint settings only for its temporary saved-credential probe client.+The probe does not write configuration, stored credentials, runtime connection+health, backup coverage or recovery readiness. PVE, PBS and PMG retain their+separate saved connection identities. The direct real-TLS regressions in+`config_handlers_connection_test.go` assert unchanged configuration and health.+The request and permission contract remains owned by api-contracts.diff --git a/frontend-modern/browser-verification/461b39e7d0660166.json b/frontend-modern/browser-verification/461b39e7d0660166.jsonnew file mode 100644index 0000000000..085a2d7706--- /dev/null+++ b/frontend-modern/browser-verification/461b39e7d0660166.json@@ -0,0 +1,60 @@+{+ "version": 1,+ "base_sha": "f4d452bf698e0e4d63376da8704d096753a68380",+ "verified_at": "2026-10-16T20:13:18Z",+ "result": "passed",+ "changed_paths": [+ "frontend-modern/src/api/nodes.ts",+ "frontend-modern/src/components/Settings/NodeModalStatusFooter.tsx",+ "frontend-modern/src/components/Settings/useNodeModalState.ts"+ ],+ "content_sha256": {+ "frontend-modern/src/api/nodes.ts": "3f227e0f405207d8ed08f16f48cfc94518a809101edce790ea58fd5463c4e0c1",+ "frontend-modern/src/components/Settings/NodeModalStatusFooter.tsx": "35fad7b3be1afa4a885a005ff883740049664897f7fb6b68428a1f7e55dab385",+ "frontend-modern/src/components/Settings/useNodeModalState.ts": "8244931621e7538d92a6010390a623e239451f0fb1cfca9216512d02aa708e4f"+ },+ "routes": [+ "/settings/infrastructure"+ ],+ "viewports": [+ {+ "width": 1440,+ "height": 1000+ },+ {+ "width": 768,+ "height": 1024+ },+ {+ "width": 390,+ "height": 844+ }+ ],+ "states": [+ "Existing PVE connection with saved credentials and SSL settings",+ "Edited fingerprint with SSL verification enabled",+ "SSL verification disabled and saved fingerprint cleared",+ "Pending probe with disabled Test connection control",+ "Probe success and probe failure with unsaved fields retained",+ "Replacement credentials using the provided-configuration probe",+ "Cancel, reopen and reload restore saved SSL settings",+ "Delete confirmation with the longer action label",+ "Guided and manual add-node footer states"+ ],+ "interactions": [+ "Open Manage, edit fingerprint, hover and focus Test connection, then test without saving",+ "Assert retained-credential requests contain the current verifySSL and fingerprint values, including false and empty string",+ "Repeat pending, success and error probes, then verify failure keeps draft inputs",+ "Cancel and reopen, test unchanged settings, replace credentials and test through the provided-configuration endpoint",+ "Dismiss with Escape and verify focus returns to Manage, then reload and confirm no updates were saved",+ "Scroll to the footer and inspect all action bounds at each viewport, including delete confirmation",+ "Dismiss by outside click on desktop, then exercise guided and manual setup footers without creating or deleting a connection",+ "Inspect actual screenshots for input focus, pending, error, replacement success, persisted settings and shared footer placement"+ ],+ "browsers": [+ "Chromium"+ ],+ "limitations": [+ "Browser requests use deterministic connection fixtures. Real TLS and retained credentials for PVE, PBS and PMG are independently covered by backend integration regressions."+ ]+}diff --git a/frontend-modern/public/docs/API.md b/frontend-modern/public/docs/API.mdindex a14a01366d..01ae152d68 100644--- a/frontend-modern/public/docs/API.md+++ b/frontend-modern/public/docs/API.md@@ -746,6 +746,13 @@ delete and re-add a connection to diagnose missing readings or identity mixing.Uses the saved connection for a live test. It is not a passive read of itslast result or a guarantee that ordinary collection recovered.+An optional JSON body can override `verifySSL` and `fingerprint` for this test+without changing the saved connection or credentials. Omitted fields keep their+saved values. Send `false` to disable CA verification or `""` to clear the saved+fingerprint for the test. A nonempty fingerprint remains enforced regardless of+`verifySSL`. Empty-body requests keep the saved TLS settings. For example,+`{"verifySSL":true,"fingerprint":"<SHA-256 fingerprint>"}` tests an edited pin.+### Refresh Cluster Nodes`POST /api/config/nodes/{id}/refresh-cluster` (admin, `settings:write`)diff --git a/frontend-modern/src/api/__tests__/nodes.test.ts b/frontend-modern/src/api/__tests__/nodes.test.tsindex bd7eadcb10..2c63265d62 100644--- a/frontend-modern/src/api/__tests__/nodes.test.ts+++ b/frontend-modern/src/api/__tests__/nodes.test.ts@@ -271,6 +271,17 @@ describe('NodesAPI', () => {);expect(result.latency).toBe(10);});++ it('sends edited TLS settings, including false and an empty fingerprint', async () => {+ vi.mocked(apiFetchJSON).mockResolvedValueOnce({ status: 'success' });++ await NodesAPI.testExistingNode('pve:saved cluster', { verifySSL: false, fingerprint: '' });++ expect(apiFetchJSON).toHaveBeenCalledWith('/api/config/nodes/pve%3Asaved%20cluster/test', {+ method: 'POST',+ body: JSON.stringify({ verifySSL: false, fingerprint: '' }),+ });+ });});describe('refreshClusterNodes', () => {diff --git a/frontend-modern/src/api/nodes.ts b/frontend-modern/src/api/nodes.tsindex 62e0b3734f..f0a8c38862 100644--- a/frontend-modern/src/api/nodes.ts+++ b/frontend-modern/src/api/nodes.ts@@ -11,6 +11,11 @@ import {type RawClusterEndpoint = Partial<ClusterEndpoint>;+export type NodeConnectionTestTLSOptions = {+ verifySSL?: boolean;+ fingerprint?: string;+};+const normalizeClusterEndpoint = (endpoint: RawClusterEndpoint): ClusterEndpoint => ({nodeId: trimmedString(endpoint.nodeId),nodeIdentity: trimmedString(endpoint.nodeIdentity),@@ -239,7 +244,10 @@ export class NodesAPI {});}- static async testExistingNode(nodeId: string): Promise<{+ static async testExistingNode(+ nodeId: string,+ tls?: NodeConnectionTestTLSOptions,+ ): Promise<{status: string;message?: string;latency?: number;@@ -247,6 +255,7 @@ export class NodesAPI {}> {return apiFetchJSON(`${this.baseUrl}/${encodeURIComponent(nodeId)}/test`, {method: 'POST',+ body: tls === undefined ? undefined : JSON.stringify(tls),});}diff --git a/frontend-modern/src/components/Settings/NodeModalStatusFooter.tsx b/frontend-modern/src/components/Settings/NodeModalStatusFooter.tsxindex 74e8d57bad..de174db137 100644--- a/frontend-modern/src/components/Settings/NodeModalStatusFooter.tsx+++ b/frontend-modern/src/components/Settings/NodeModalStatusFooter.tsx@@ -124,14 +124,14 @@ export const NodeModalStatusFooter: Component<NodeModalStatusFooterProps> = (pro)}</Show>- <div class="flex items-center justify-between px-6 py-4 border-t border-border">- <div class="flex items-center gap-3">+ <div class="flex flex-col gap-3 px-4 py-4 border-t border-border sm:flex-row sm:flex-wrap sm:items-center sm:justify-between sm:px-6">+ <div class="flex min-w-0 flex-wrap items-center gap-3"><Show when={state.isEditingExistingNode() && props.onDelete}><buttontype="button"onClick={props.onDelete}disabled={props.togglePending || props.deletePending}- class={`px-4 py-2 text-sm rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed ${+ class={`flex-1 px-4 py-2 text-sm rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed sm:flex-none ${props.deleteConfirming? 'bg-rose-600 text-white hover:bg-rose-700': 'border border-rose-300 text-rose-700 hover:bg-rose-50 dark:border-rose-900/25 dark:text-rose-300 dark:hover:bg-rose-950/25'@@ -154,20 +154,20 @@ export const NodeModalStatusFooter: Component<NodeModalStatusFooterProps> = (protype="button"onClick={state.handleTestConnection}disabled={state.isTesting() || props.togglePending || props.deletePending}- class="px-4 py-2 text-sm border border-border text-base-content rounded-md hover:bg-surface-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed"+ class="flex-1 px-4 py-2 text-sm border border-border text-base-content rounded-md hover:bg-surface-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed sm:flex-none">{state.isTesting() ? 'Testing…' : 'Test connection'}</button></Show></div>- <div class="flex items-center gap-3">+ <div class="flex min-w-0 flex-wrap items-center justify-end gap-3"><Show when={state.isEditingExistingNode() && props.onToggleEnabled}><buttontype="button"onClick={props.onToggleEnabled}disabled={props.togglePending || props.deletePending}- class="px-4 py-2 text-sm border border-border text-base-content rounded-md hover:bg-surface-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed"+ class="w-full px-4 py-2 text-sm border border-border text-base-content rounded-md hover:bg-surface-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed sm:w-auto">{props.togglePending? props.connectionEnabled@@ -185,7 +185,7 @@ export const NodeModalStatusFooter: Component<NodeModalStatusFooterProps> = (promodalProps.onBackToDiscovery!();modalProps.onClose();}}- class="px-4 py-2 text-sm border border-border text-base-content rounded-md hover:bg-surface-hover transition-colors flex items-center gap-2"+ class="w-full px-4 py-2 text-sm border border-border text-base-content rounded-md hover:bg-surface-hover transition-colors flex items-center justify-center gap-2 sm:w-auto"><svgwidth="16"@@ -205,7 +205,7 @@ export const NodeModalStatusFooter: Component<NodeModalStatusFooterProps> = (protype="button"onClick={modalProps.onClose}disabled={props.togglePending || props.deletePending}- class="px-4 py-2 text-sm border border-border text-base-content rounded-md hover:bg-surface-hover transition-colors"+ class="flex-1 px-4 py-2 text-sm border border-border text-base-content rounded-md hover:bg-surface-hover transition-colors sm:flex-none">{guidedSetupOnlyMode() ? 'Close' : 'Cancel'}</button>@@ -214,7 +214,7 @@ export const NodeModalStatusFooter: Component<NodeModalStatusFooterProps> = (protype="submit"disabled={props.togglePending || props.deletePending || props.saveDisabled}title={props.saveDisabled ? props.saveDisabledReason : undefined}- class="px-4 py-2 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"+ class="flex-1 px-4 py-2 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed sm:flex-none">{state.isEditingExistingNode() ? 'Save changes' : 'Add node'}</button>diff --git a/frontend-modern/src/components/Settings/__tests__/useNodeModalState.connectionTest.test.ts b/frontend-modern/src/components/Settings/__tests__/useNodeModalState.connectionTest.test.tsnew file mode 100644index 0000000000..2922257190--- /dev/null+++ b/frontend-modern/src/components/Settings/__tests__/useNodeModalState.connectionTest.test.ts@@ -0,0 +1,97 @@+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import { createRoot } from 'solid-js';+import { NodesAPI } from '@/api/nodes';+import type { NodeConfig } from '@/types/nodes';+import { useNodeModalState, type NodeModalState } from '../useNodeModalState';+import type { NodeModalProps } from '../nodeModalModel';++vi.mock('@/api/nodes', () => ({+ NodesAPI: { testExistingNode: vi.fn(), testConnection: vi.fn() },+}));+vi.mock('@/utils/clipboard', () => ({ copyToClipboard: vi.fn() }));++describe('connection tests with retained credentials', () => {+ let dispose: (() => void) | undefined;++ beforeEach(() => {+ vi.clearAllMocks();+ vi.mocked(NodesAPI.testExistingNode).mockResolvedValue({ status: 'success' });+ vi.mocked(NodesAPI.testConnection).mockResolvedValue({ status: 'success' });+ });++ afterEach(() => dispose?.());++ const mount = (nodeType: NodeModalProps['nodeType']) => {+ let state!: NodeModalState;+ dispose = createRoot((cleanup) => {+ state = useNodeModalState({+ isOpen: true,+ nodeType,+ editingNode: {+ id: `${nodeType}-saved`,+ type: nodeType,+ name: 'saved',+ host: 'https://node.example.test:8006',+ tokenName: 'root@pam!pulse',+ fingerprint: 'saved-pin',+ verifySSL: true,+ } as NodeConfig,+ onClose: vi.fn(),+ onSave: vi.fn(),+ });+ return cleanup;+ });+ return state;+ };++ it.each(['pve', 'pbs', 'pmg'] as const)(+ 'tests edited TLS settings for %s without replacing credentials',+ async (platform) => {+ const state = mount(platform);+ state.updateField('verifySSL', false);+ state.updateField('fingerprint', '');++ await state.handleTestConnection();++ expect(NodesAPI.testExistingNode).toHaveBeenCalledWith(`${platform}-saved`, {+ verifySSL: false,+ fingerprint: '',+ });+ expect(NodesAPI.testConnection).not.toHaveBeenCalled();+ expect(state.testResult()?.status).toBe('success');+ expect(state.formData().verifySSL).toBe(false);+ expect(state.formData().fingerprint).toBe('');+ },+ );++ it('tests an edited fingerprint with verification enabled', async () => {+ const state = mount('pve');+ state.updateField('fingerprint', 'edited-pin');++ await state.handleTestConnection();++ expect(NodesAPI.testExistingNode).toHaveBeenCalledWith('pve-saved', {+ verifySSL: true,+ fingerprint: 'edited-pin',+ });+ });++ it('uses the supplied credentials when they are replaced', async () => {+ const state = mount('pve');+ state.updateField('authType', 'token');+ state.updateField('tokenValue', 'replacement-token');+ state.updateField('verifySSL', false);+ state.updateField('fingerprint', '');++ await state.handleTestConnection();++ expect(NodesAPI.testExistingNode).not.toHaveBeenCalled();+ expect(NodesAPI.testConnection).toHaveBeenCalledWith(+ expect.objectContaining({+ tokenValue: 'replacement-token',+ verifySSL: false,+ fingerprint: '',+ }),+ );+ });+});diff --git a/frontend-modern/src/components/Settings/useNodeModalState.ts b/frontend-modern/src/components/Settings/useNodeModalState.tsindex b3f76c6635..aed7340326 100644--- a/frontend-modern/src/components/Settings/useNodeModalState.ts+++ b/frontend-modern/src/components/Settings/useNodeModalState.ts@@ -553,7 +553,10 @@ export const useNodeModalState = (props: NodeModalProps) => {setTestResult(null);try {- const result = await NodesAPI.testExistingNode(props.editingNode!.id);+ const result = await NodesAPI.testExistingNode(props.editingNode!.id, {+ verifySSL: data.verifySSL,+ fingerprint: data.fingerprint,+ });setTestResult({status: 'success',message: result.message || 'Connection successful',diff --git a/frontend-modern/src/utils/__tests__/docsLinks.test.ts b/frontend-modern/src/utils/__tests__/docsLinks.test.tsindex 90baad2b04..347b24fb20 100644--- a/frontend-modern/src/utils/__tests__/docsLinks.test.ts+++ b/frontend-modern/src/utils/__tests__/docsLinks.test.ts@@ -738,6 +738,23 @@ describe('docsLinks', () => {expect(setup).not.toContain('token-bearing `commandWithEnv`');});+ it('ships the saved-credential probe TLS override contract', () => {+ const apiReference = readFileSync(path.join(repoRoot, 'docs', 'API.md'), 'utf8');+ const shipped = readFileSync(path.join(frontendRoot, 'public', 'docs', 'API.md'), 'utf8');+ const probe = apiReference+ .split('### Test Node (Legacy)')[1]+ .split('### Refresh Cluster Nodes')[0];++ expect(shipped).toBe(apiReference);+ expect(probe).toContain('`POST /api/config/nodes/{id}/test` (admin, `settings:write`)');+ expect(probe).toContain('optional JSON body can override `verifySSL` and `fingerprint`');+ expect(probe).toContain('without changing the saved connection or credentials');+ expect(probe).toMatch(/Omitted fields keep their\s+saved values/);+ expect(probe).toContain('`false` to disable CA verification or `""` to clear the saved');+ expect(probe).toMatch(/nonempty fingerprint remains enforced regardless of\s+`verifySSL`/);+ expect(probe).toContain('Empty-body requests keep the saved TLS settings');+ });+it('ships the per-alert snooze and resume API contract', () => {const apiReference = readFileSync(path.join(repoRoot, 'docs', 'API.md'), 'utf8');const shippedAPIReference = readFileSync(diff --git a/internal/api/configapi/config_handlers_connection_test.go b/internal/api/configapi/config_handlers_connection_test.goindex 93b7967d4a..5140bfd5ac 100644--- a/internal/api/configapi/config_handlers_connection_test.go+++ b/internal/api/configapi/config_handlers_connection_test.go@@ -2,12 +2,15 @@ package configapiimport ("bytes"+ "crypto/sha256""encoding/json"+ "fmt""net/http""net/http/httptest""os""reflect""strings"+ "sync/atomic""testing""github.com/rcourtman/pulse-go-rewrite/internal/config"@@ -170,3 +173,102 @@ func TestHandleTestNodePBSIsADirectProbeWithoutChangingRuntimeHealth(t *testing.t.Fatal("direct PBS test mutated the runtime connection projection")}}++func TestHandleTestNodeUsesEditedTLSWithoutChangingSavedConfiguration(t *testing.T) {+ for _, platform := range []string{"pve", "pbs", "pmg"} {+ t.Run(platform, func(t *testing.T) {+ var authenticated atomic.Bool+ server := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ if strings.Contains(r.Header.Get("Authorization"), "stored-secret") {+ authenticated.Store(true)+ }+ w.Header().Set("Content-Type", "application/json")+ if r.URL.Path == "/api2/json/access/ticket" {+ var login map[string]string+ if err := json.NewDecoder(r.Body).Decode(&login); err != nil {+ t.Error(err)+ }+ if login["password"] == "stored-secret" {+ authenticated.Store(true)+ }+ _, _ = w.Write([]byte(`{"data":{"ticket":"test-ticket","CSRFPreventionToken":"test-csrf"}}`))+ return+ }+ if platform == "pmg" {+ _, _ = w.Write([]byte(`{"data":{"version":"8.2","release":"1"}}`))+ return+ }+ _, _ = w.Write([]byte(`{"data":[]}`))+ }))+ defer server.Close()+ fingerprint := fmt.Sprintf("%x", sha256.Sum256(server.Certificate().Raw))+ wrongFingerprint := strings.Repeat("00", sha256.Size)++ for _, tc := range []struct {+ name string+ savedVerify bool+ savedPin string+ body string+ wantStatus int+ }{+ {"edited fingerprint", true, "", fmt.Sprintf(`{"verifySSL":true,"fingerprint":%q}`, fingerprint), http.StatusOK},+ {"edited verification and cleared fingerprint", true, wrongFingerprint, `{"verifySSL":false,"fingerprint":""}`, http.StatusOK},+ {"edited strict verification", false, "", `{"verifySSL":true,"fingerprint":""}`, http.StatusBadRequest},+ {"cleared saved fingerprint", true, fingerprint, `{"fingerprint":""}`, http.StatusBadRequest},+ {"omitted verification retains saved value", true, "", fmt.Sprintf(`{"fingerprint":%q}`, fingerprint), http.StatusOK},+ {"omitted fingerprint retains saved pin", false, wrongFingerprint, `{"verifySSL":false}`, http.StatusBadRequest},+ {"empty body retains saved TLS", true, fingerprint, "", http.StatusOK},+ {"empty object retains saved TLS", true, fingerprint, `{}`, http.StatusOK},+ {"invalid JSON rejected", false, "", `{`, http.StatusBadRequest},+ {"invalid TLS type rejected", false, "", `{"verifySSL":"false"}`, http.StatusBadRequest},+ {"trailing JSON rejected", false, "", `{} {}`, http.StatusBadRequest},+ {"unknown fields rejected", false, "", `{"password":"replacement"}`, http.StatusBadRequest},+ {"oversized body rejected", false, "", `{"fingerprint":"` + strings.Repeat("a", 32*1024) + `"}`, http.StatusBadRequest},+ } {+ t.Run(tc.name, func(t *testing.T) {+ authenticated.Store(false)+ cfg := &config.Config{DataPath: t.TempDir()}+ t.Setenv("PULSE_DATA_DIR", cfg.DataPath)+ switch platform {+ case "pve":+ cfg.PVEInstances = []config.PVEInstance{{Name: "saved", Host: server.URL, TokenName: "root@pam!pulse", TokenValue: "stored-secret", VerifySSL: tc.savedVerify, Fingerprint: tc.savedPin}}+ case "pbs":+ cfg.PBSInstances = []config.PBSInstance{{Name: "saved", Host: server.URL, TokenName: "root@pam!pulse", TokenValue: "stored-secret", VerifySSL: tc.savedVerify, Fingerprint: tc.savedPin}}+ case "pmg":+ cfg.PMGInstances = []config.PMGInstance{{Name: "saved", Host: server.URL, User: "root@pam", Password: "stored-secret", VerifySSL: tc.savedVerify, Fingerprint: tc.savedPin}}+ }+ handler := newTestConfigHandlers(t, cfg)+ before, err := json.Marshal(cfg)+ if err != nil {+ t.Fatal(err)+ }+ beforeHealth := handler.defaultMonitor.SchedulerHealth()+ beforeStatuses := handler.defaultMonitor.GetConnectionStatuses()+ req := httptest.NewRequest(http.MethodPost, "/api/config/nodes/"+platform+"-0/test", strings.NewReader(tc.body))+ rec := httptest.NewRecorder()+ handler.HandleTestNode(rec, req)+ if rec.Code != tc.wantStatus {+ t.Fatalf("probe status = %d, want %d, body=%s", rec.Code, tc.wantStatus, rec.Body.String())+ }+ if tc.wantStatus == http.StatusOK && !authenticated.Load() {+ t.Fatal("probe did not use the saved credential")+ }+ after, err := json.Marshal(cfg)+ if err != nil {+ t.Fatal(err)+ }+ if !bytes.Equal(before, after) {+ t.Fatal("probe mutated the saved configuration")+ }+ afterHealth := handler.defaultMonitor.SchedulerHealth()+ if !reflect.DeepEqual(afterHealth.Instances, beforeHealth.Instances) ||+ !reflect.DeepEqual(afterHealth.Breakers, beforeHealth.Breakers) ||+ !reflect.DeepEqual(afterHealth.Staleness, beforeHealth.Staleness) ||+ !reflect.DeepEqual(handler.defaultMonitor.GetConnectionStatuses(), beforeStatuses) {+ t.Fatal("probe mutated runtime connection health")+ }+ })+ }+ })+ }+}diff --git a/internal/api/configapi/config_node_handlers.go b/internal/api/configapi/config_node_handlers.goindex 2bcaf0aeb4..b5a2514873 100644--- a/internal/api/configapi/config_node_handlers.go+++ b/internal/api/configapi/config_node_handlers.go@@ -5,6 +5,7 @@ import ("encoding/json""errors""fmt"+ "io""net""net/http""net/url"@@ -2139,7 +2140,25 @@ func (h *ConfigHandlers) handleTestNodeConfig(w http.ResponseWriter, r *http.Reqjson.NewEncoder(w).Encode(testResult)}-// HandleTestNode tests a node connection+// nodeConnectionTestTLSOptions overrides only the temporary probe's TLS policy.+// Pointers distinguish omitted settings from explicitly disabling verification+// or clearing a saved fingerprint. Credentials remain server-side.+type nodeConnectionTestTLSOptions struct {+ VerifySSL *bool `json:"verifySSL"`+ Fingerprint *string `json:"fingerprint"`+}++func (o nodeConnectionTestTLSOptions) apply(verifySSL bool, fingerprint string) (bool, string) {+ if o.VerifySSL != nil {+ verifySSL = *o.VerifySSL+ }+ if o.Fingerprint != nil {+ fingerprint = *o.Fingerprint+ }+ return verifySSL, fingerprint+}++// HandleTestNode tests saved credentials with optional, non-persistent TLS edits.func (h *ConfigHandlers) handleTestNode(w http.ResponseWriter, r *http.Request) {path := strings.TrimPrefix(r.URL.Path, "/api/config/nodes/")@@ -2161,11 +2180,27 @@ func (h *ConfigHandlers) handleTestNode(w http.ResponseWriter, r *http.Request)return}+ var tlsOptions nodeConnectionTestTLSOptions+ if r.Body != nil {+ decoder := json.NewDecoder(http.MaxBytesReader(w, r.Body, 32*1024))+ decoder.DisallowUnknownFields()+ if err := decoder.Decode(&tlsOptions); err != nil {+ if !errors.Is(err, io.EOF) {+ http.Error(w, "Invalid request body", http.StatusBadRequest)+ return+ }+ } else if err := decoder.Decode(&struct{}{}); !errors.Is(err, io.EOF) {+ http.Error(w, "Invalid request body", http.StatusBadRequest)+ return+ }+ }+// Find the node to testvar testResult map[string]interface{}if nodeType == "pve" && index < len(h.getConfig(r.Context()).PVEInstances) {pve := h.getConfig(r.Context()).PVEInstances[index]+ verifySSL, fingerprint := tlsOptions.apply(pve.VerifySSL, pve.Fingerprint)// Create a temporary client to test connectionauthUser := pve.User@@ -2178,8 +2213,8 @@ func (h *ConfigHandlers) handleTestNode(w http.ResponseWriter, r *http.Request)Password: pve.Password,TokenName: pve.TokenName,TokenValue: pve.TokenValue,- VerifySSL: pve.VerifySSL,- Fingerprint: pve.Fingerprint,+ VerifySSL: verifySSL,+ Fingerprint: fingerprint,}client, err := proxmox.NewClient(clientConfig)if err != nil {@@ -2209,6 +2244,7 @@ func (h *ConfigHandlers) handleTestNode(w http.ResponseWriter, r *http.Request)}} else if nodeType == "pbs" && index < len(h.getConfig(r.Context()).PBSInstances) {pbsInstance := h.getConfig(r.Context()).PBSInstances[index]+ verifySSL, fingerprint := tlsOptions.apply(pbsInstance.VerifySSL, pbsInstance.Fingerprint)// Create a temporary client to test connectionclientConfig := pbs.ClientConfig{@@ -2217,8 +2253,8 @@ func (h *ConfigHandlers) handleTestNode(w http.ResponseWriter, r *http.Request)Password: pbsInstance.Password,TokenName: pbsInstance.TokenName,TokenValue: pbsInstance.TokenValue,- VerifySSL: pbsInstance.VerifySSL,- Fingerprint: pbsInstance.Fingerprint,+ VerifySSL: verifySSL,+ Fingerprint: fingerprint,}client, err := pbs.NewClient(clientConfig)if err != nil {@@ -2250,6 +2286,7 @@ func (h *ConfigHandlers) handleTestNode(w http.ResponseWriter, r *http.Request)pmgInstance := h.getConfig(r.Context()).PMGInstances[index]clientConfig := config.CreatePMGConfig(&pmgInstance)+ clientConfig.VerifySSL, clientConfig.Fingerprint = tlsOptions.apply(clientConfig.VerifySSL, clientConfig.Fingerprint)if pmgInstance.Password != "" && pmgInstance.TokenName == "" && pmgInstance.TokenValue == "" {if clientConfig.User != "" && !strings.Contains(clientConfig.User, "@") {clientConfig.User = clientConfig.User + "@pmg"diff --git a/scripts/release_control/canonical_completion_guard_test.py b/scripts/release_control/canonical_completion_guard_test.pyindex 7561f5ef95..d03376b3cf 100644--- a/scripts/release_control/canonical_completion_guard_test.py+++ b/scripts/release_control/canonical_completion_guard_test.py@@ -1375,6 +1375,7 @@ class CanonicalCompletionGuardTest(unittest.TestCase):"internal/api/audit_handlers_test.go","internal/api/availability_handlers_test.go","internal/api/chartapi/history_activity_test.go",+ "internal/api/configapi/config_handlers_connection_test.go","internal/api/contract_test.go","internal/api/docker_agents_report_size_test.go","internal/api/docker_container_action_executor_test.go",