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.

Admit authenticated alert readers and align Diagnostics proof

pulse-triage[bot]a2ada6b6a990
diff --git a/frontend-modern/browser-verification/e928c9bee80a299b.json b/frontend-modern/browser-verification/e928c9bee80a299b.json
new file mode 100644
index 0000000000..9add5c740b
--- /dev/null
+++ b/frontend-modern/browser-verification/e928c9bee80a299b.json
@@ -0,0 +1,37 @@
+{
+ "version": 1,
+ "base_sha": "0aaaa39684c8f494ef06eff043bb883f6f65630e",
+ "verified_at": "2026-11-02T20:37:30.067103Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/pages/Alerts.tsx"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/pages/Alerts.tsx": "e7ed8e2e8a865ddd3858259ae13339e20534c4b13ed30ed316f637d90a3fa792"
+ },
+ "routes": [
+ "/alerts/thresholds/infrastructure",
+ "/alerts/thresholds/truenas",
+ "/alerts/destinations",
+ "/settings/infrastructure"
+ ],
+ "viewports": [
+ {
+ "width": 1280,
+ "height": 720
+ },
+ {
+ "width": 393,
+ "height": 727
+ }
+ ],
+ "states": [
+ "Actual App with safe HTTP fixtures: security status detailLevel=privileged and requiresAuth=true, matching the native producer semantics rather than granting new scopes. Chromium desktop and mobile Chrome/Pixel 5; Playwright 1.56.1.",
+ "Complete registered TrueNAS/Ceph threshold, VMware/TrueNAS/Apprise TLS-warning and powered-off tolerance cases on desktop; the five applicable cases also pass on mobile Chrome. Desktop-only TrueNAS threshold case is skipped on mobile as registered."
+ ],
+ "interactions": [
+ "Live threshold tabs and Ceph row controls render; keyboard expansion excludes collapsed controls from focus. Apprise warning checkbox works and retains its persistent warning. Powered-off policy preserves inheritance, explicit zero and strict validation. No server permission, grant or production TLS change.",
+ "Desktop Apprise and narrow Notifications captures opened natively with view_image: readable existing controls after authenticated admission. The narrow capture depicts the external-watchdog card rather than the offscreen Apprise warning; TLS-warning visibility is separately asserted in the registered browser test.",
+ "Initial desktop batch: five passes and one evidence-fixture error boundary caused by an empty external-watchdog state object; adding the native disabled-state discriminator permits only the unfinished Apprise case to pass. No source relaxation. WebKit launch-flag error and subsequent remaining cases are retained separately; neither is represented as a product pass. Full source execution and native/account recovery remain separate."
+ ]
+}
diff --git a/frontend-modern/src/pages/Alerts.tsx b/frontend-modern/src/pages/Alerts.tsx
index 033bfdd5b2..ae286ecb32 100644
--- a/frontend-modern/src/pages/Alerts.tsx
+++ b/frontend-modern/src/pages/Alerts.tsx
@@ -75,7 +75,13 @@ export function Alerts(props: { securityStatus?: SecurityStatus | null }) {
// reader must never inherit destination credentials or an in-flight editor.
const configurationReader = createMemo(() => {
const status = props.securityStatus;
- if (!status || status.requiresAuth !== false || readOnlySession()) return undefined;
+ // requiresAuth describes the install's login configuration, not whether
+ // this request authenticated. Signed-in installs still return true.
+ const readerKnown =
+ status?.requiresAuth === false ||
+ status?.detailLevel === 'authenticated' ||
+ status?.detailLevel === 'privileged';
+ if (!status || !readerKnown || readOnlySession()) return undefined;
return JSON.stringify([
workspaceRevision(),
getOrgID() || 'default',
diff --git a/frontend-modern/src/pages/__tests__/Alerts.readOnly.test.tsx b/frontend-modern/src/pages/__tests__/Alerts.readOnly.test.tsx
index ff9c59f936..69591c2c3c 100644
--- a/frontend-modern/src/pages/__tests__/Alerts.readOnly.test.tsx
+++ b/frontend-modern/src/pages/__tests__/Alerts.readOnly.test.tsx
@@ -113,7 +113,9 @@ vi.mock('@/features/alerts/AlertsConfigurationSurface', () => ({
}));
const admittedStatus = {
- requiresAuth: false,
+ detailLevel: 'privileged',
+ hasAuthentication: true,
+ requiresAuth: true,
currentUsername: 'alice',
apiTokenHint: 'hint-a',
tokenScopes: ['settings:read', 'settings:write'],
@@ -147,6 +149,48 @@ describe('Alerts read-only presentation', () => {
expect(configurationSurfaceSpy).not.toHaveBeenCalled();
});
+ for (const detailLevel of ['authenticated', 'privileged'] as const)
+ it(`admits a ${detailLevel} reader on an install that requires login`, () => {
+ render(() => <Alerts securityStatus={{ ...admittedStatus, detailLevel }} />);
+ expect(screen.getByTestId('alerts-config-surface')).toBeInTheDocument();
+ });
+
+ it('preserves configuration access on an auth-free install', () => {
+ render(() => (
+ <Alerts
+ securityStatus={{ detailLevel: 'public', requiresAuth: false, hasAuthentication: false }}
+ />
+ ));
+ expect(screen.getByTestId('alerts-config-surface')).toBeInTheDocument();
+ });
+
+ for (const detailLevel of ['public', undefined] as const)
+ it(`withholds configuration from ${detailLevel ?? 'unresolved'} login discovery`, () => {
+ locationState.pathname = '/alerts/thresholds';
+ render(() => (
+ <Alerts securityStatus={{ requiresAuth: true, hasAuthentication: true, detailLevel }} />
+ ));
+ expect(screen.queryByTestId('alerts-config-surface')).not.toBeInTheDocument();
+ expect(screen.getByRole('status')).toHaveTextContent('Alert settings access is unavailable');
+ });
+
+ it('retires a signed-in editor when status becomes public and admits only a fresh authenticated editor', async () => {
+ const retired = vi.fn();
+ configurationSurfaceSpy.mockImplementation(() => {
+ onCleanup(retired);
+ return <div data-testid="alerts-config-surface">Config</div>;
+ });
+ const [status, setStatus] = createSignal<SecurityStatus>(admittedStatus);
+ render(() => <Alerts securityStatus={status()} />);
+ expect(screen.getByTestId('alerts-config-surface')).toBeInTheDocument();
+ setStatus({ requiresAuth: true, hasAuthentication: true, detailLevel: 'public' });
+ await waitFor(() => expect(retired).toHaveBeenCalledTimes(1));
+ expect(screen.queryByTestId('alerts-config-surface')).not.toBeInTheDocument();
+ setStatus({ ...admittedStatus, detailLevel: 'authenticated' });
+ await screen.findByTestId('alerts-config-surface');
+ expect(configurationSurfaceSpy).toHaveBeenCalledTimes(2);
+ });
+
it('keeps equivalent reader facts mounted, but retires user, token, scope and workspace lifetimes', async () => {
const retired = vi.fn();
configurationSurfaceSpy.mockImplementation(() => {
diff --git a/tests/integration/tests/69-diagnostics-onboarding.spec.ts b/tests/integration/tests/69-diagnostics-onboarding.spec.ts
index 3d6f292ec8..807c3e40a7 100644
--- a/tests/integration/tests/69-diagnostics-onboarding.spec.ts
+++ b/tests/integration/tests/69-diagnostics-onboarding.spec.ts
@@ -345,8 +345,9 @@ const test = base.extend<{}, WorkerFixtures>({
async function prepareDiagnosticsRoute(
page: Page,
- payload: typeof DIAGNOSTICS_PAYLOAD | typeof EXPORT_DIAGNOSTICS_PAYLOAD =
- DIAGNOSTICS_PAYLOAD,
+ payload:
+ | typeof DIAGNOSTICS_PAYLOAD
+ | typeof EXPORT_DIAGNOSTICS_PAYLOAD = DIAGNOSTICS_PAYLOAD,
): Promise<DiagnosticsTraffic> {
const traffic: DiagnosticsTraffic = { reads: 0, writes: [] };
page.on("request", (request) => {
@@ -603,9 +604,8 @@ test.describe("Diagnostics safe collection and local exports", () => {
expect(traffic.reads).toBe(1);
expect(traffic.writes).toEqual(writesBeforeExport);
await expect(
- page.getByRole("heading", {
- name: "Full diagnostics downloaded — keep this file private",
- exact: true,
+ page.getByRole("status").filter({
+ hasText: "Full diagnostics downloaded — keep this file private",
}),
).toBeVisible();
@@ -678,9 +678,8 @@ test.describe("Diagnostics safe collection and local exports", () => {
expect(traffic.reads).toBe(1);
expect(traffic.writes).toEqual(writesBeforeExport);
await expect(
- page.getByRole("heading", {
- name: "Sanitised diagnostics downloaded — review before sharing",
- exact: true,
+ page.getByRole("status").filter({
+ hasText: "Sanitised diagnostics downloaded — review before sharing",
}),
).toBeVisible();
// A full export after sanitisation must still be the original displayed
@@ -700,7 +699,7 @@ test.describe("Diagnostics safe collection and local exports", () => {
});
});
- test("disables exports during a refresh and retains the previous result after a failed live check", async ({
+ test("withdraws exports during refresh and failure, then restores them only from a successful fresh check", async ({
page,
}, testInfo) => {
let reads = 0;
@@ -711,10 +710,15 @@ test.describe("Diagnostics safe collection and local exports", () => {
await page.route("**/api/diagnostics", async (route) => {
reads += 1;
if (reads === 1) return route.fulfill({ json: DIAGNOSTICS_PAYLOAD });
- await held;
+ if (reads === 2) {
+ await held;
+ return route.fulfill({
+ status: 400,
+ json: { error: "Synthetic private provider detail" },
+ });
+ }
return route.fulfill({
- status: 400,
- json: { error: "Synthetic live check failed" },
+ json: { ...DIAGNOSTICS_PAYLOAD, version: "6.7.0-fresh" },
});
});
await openDiagnostics(page);
@@ -736,20 +740,32 @@ test.describe("Diagnostics safe collection and local exports", () => {
await expect(
page.getByRole("button", { name: "Running...", exact: true }),
).toBeDisabled();
- await expect(full).toBeDisabled();
- await expect(github).toBeDisabled();
+ // A pending check cannot certify current access to the previous result.
+ await expect(full).toHaveCount(0);
+ await expect(github).toHaveCount(0);
+ await expect(page.getByText("Metrics Store", { exact: false })).toHaveCount(
+ 0,
+ );
expect(reads).toBe(2);
await page.screenshot({
path: testInfo.outputPath("diagnostics-refresh-disabled.png"),
fullPage: true,
});
release!();
+ await expect(page.getByRole("alert")).toContainText(
+ "Diagnostics could not be loaded. Previous results have been cleared.",
+ );
await expect(
- page.getByRole("heading", {
- name: "Synthetic live check failed",
- exact: true,
- }),
- ).toBeVisible();
+ page.getByText("Synthetic private provider detail", { exact: true }),
+ ).toHaveCount(0);
+ await expect(full).toHaveCount(0);
+ await expect(github).toHaveCount(0);
+ await expect(page.getByText("Metrics Store", { exact: false })).toHaveCount(
+ 0,
+ );
+ // Explicit recovery is safe here because every producer is a local fixture.
+ // A failed check must never offer the previous private file for download.
+ await run.click();
await expect(full).toBeEnabled();
await expect(github).toBeEnabled();
const {
@@ -757,10 +773,11 @@ test.describe("Diagnostics safe collection and local exports", () => {
commercialFunnel: _funnel,
...expectedFull
} = DIAGNOSTICS_PAYLOAD;
- expect(await downloadJSON(page, "Full (private)", "full")).toEqual(
- expectedFull,
- );
- expect(reads).toBe(2);
+ expect(await downloadJSON(page, "Full (private)", "full")).toEqual({
+ ...expectedFull,
+ version: "6.7.0-fresh",
+ });
+ expect(reads).toBe(3);
await scrollToBottom(page);
await assertControlsInViewport(
page,