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.

Harden public demo shell boundaries

rcourtmandf2fccb0119a
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md
index d3e57ecf63..b2d40eb215 100644
--- a/docs/release-control/v6/internal/subsystems/alerts.md
+++ b/docs/release-control/v6/internal/subsystems/alerts.md
@@ -135,6 +135,11 @@ page must behave as a reporting surface: overview/history remain available,
alert activation controls stay hidden, configuration tabs must not render or
remain navigable, and the overview empty state must not tell public demo users
to toggle alerting back on when demo mode already blocks write requests.
+The alerts page also owns its mobile tab-shell presentation directly.
+`frontend-modern/src/pages/Alerts.tsx` may keep alert-specific active and
+disabled tab styling, but horizontal tab scrolling must route through the
+shared `touch-scroll` / `scrollbar-hide` class contract instead of writing
+inline overflow styles that break CSP on the public shell.
That shared alert presentation boundary now also has explicit alerts ownership.
`frontend-modern/src/utils/alertWebhookPresentation.ts` is the canonical owner
for webhook setup copy, service labels, mention-help phrasing, custom-field
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 470475578a..612535ab3b 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -242,7 +242,8 @@ when the disabled candidate no longer counts toward monitored-system capacity.
probes, or hostname heuristics. Shared browser stores that consume
Patrol approvals must also fail closed from that resolved demo policy at
the store boundary, so public demo shells do not probe `/api/ai/approvals`
- after the read-only demo posture is already known.
+ or `/api/ai/remediation/plans` after the read-only demo posture is already
+ known.
33. Keep public demo commercial posture middleware-owned on that same shared
API contract. `internal/api/demo_middleware.go`,
`internal/api/demo_mode_commercial.go`,
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 1744f43ae2..d2747dc958 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -194,7 +194,10 @@ work extends shared components instead of creating new local variants.
`frontend-modern/src/components/shared/Table.tsx` must keep touch-scroll
behavior on classes and shared CSS in `frontend-modern/src/index.css`
instead of reintroducing inline `style=` attributes for overflow or mobile
- scroll behavior.
+ scroll behavior. `frontend-modern/src/components/shared/PulseDataGrid.tsx`
+ inherits that same boundary: shared data-grid shells must route scrollbar
+ hiding and table-width sizing through shared classes plus HTML attributes,
+ not inline overflow or min-width styles.
3. Add feature-specific presentation only when no shared primitive should own it
4. Add guardrail tests when a new shared pattern is introduced
5. Keep shared platform-connections shell state on the reusable settings boundary: `frontend-modern/src/components/Settings/useSettingsInfrastructurePanelProps.ts`, `frontend-modern/src/components/Settings/InfrastructurePlatformConnectionsSummaryCard.tsx`, and `frontend-modern/src/components/Settings/PlatformConnectionsWorkspace.tsx` must continue to derive provider counts, availability, and shared subtab copy from one infrastructure-settings source instead of creating provider-local summary fetches or VMware-only shell vocabulary.
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 8c6d651f0b..27cf853d60 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -155,6 +155,13 @@ That same shared policy now also owns Patrol approval polling posture.
empty queue from the shared store boundary itself, so dashboard and Patrol
shells do not probe `/api/ai/approvals` after the read-only demo policy has
resolved.
+That same store-owned demo boundary also covers remediation artifacts.
+`frontend-modern/src/stores/aiIntelligence.ts` must fail
+`loadRemediationPlans()` closed in public demo mode and
+`frontend-modern/src/components/AI/FindingsPanel.tsx` must consume
+`aiIntelligenceStore.remediationPlans` instead of issuing its own
+`AIAPI.getRemediationPlans()` read, so the public Patrol page does not trigger
+`/api/ai/remediation/plans` paywall probes after demo posture has resolved.
That same posture split now also centralizes Patrol commercial bootstrap.
`frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts` and
`frontend-modern/src/components/patrol/ApprovalSection.tsx` may consume the
diff --git a/frontend-modern/src/components/AI/FindingsPanel.tsx b/frontend-modern/src/components/AI/FindingsPanel.tsx
index 2ee972ed40..e47e647cf6 100644
--- a/frontend-modern/src/components/AI/FindingsPanel.tsx
+++ b/frontend-modern/src/components/AI/FindingsPanel.tsx
@@ -18,13 +18,12 @@ import { notificationStore } from '@/stores/notifications';
import { aiChatStore } from '@/stores/aiChat';
import { useResources } from '@/hooks/useResources';
import { InvestigationSection, ApprovalSection } from '@/components/patrol';
-import { AIAPI, type RemediationPlan } from '@/api/ai';
+import type { RemediationPlan } from '@/api/ai';
import type { PatrolRunRecord, PatrolRuntimeState } from '@/api/patrol';
import { buildResolvedResourceSurfaceLinks } from '@/routing/resourceLinks';
import { getApprovalRiskPresentation } from '@/utils/approvalRiskPresentation';
import { formatRelativeTime } from '@/utils/format';
import { getFindingAlertIdentifier, hasTriggeringAlert } from '@/utils/findingAlertIdentity';
-import { logger } from '@/utils/logger';
import { segmentedButtonClass } from '@/utils/segmentedButton';
import { getSemanticTonePresentation } from '@/utils/semanticTonePresentation';
import { formatIdentifierLabel } from '@/utils/textPresentation';
@@ -102,19 +101,20 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {
>('will_fix_later');
const [dismissNote, setDismissNote] = createSignal('');
- // Remediation plan artifacts (generated by Patrol and/or investigations).
- const [remediationPlans, setRemediationPlans] = createSignal<RemediationPlan[]>([]);
+ const [dismissedPlanIds, setDismissedPlanIds] = createSignal<string[]>([]);
const handleDismissPlan = async (plan: RemediationPlan, e: Event) => {
e.stopPropagation();
- setRemediationPlans((prev) => prev.filter((p) => p.id !== plan.id));
+ setDismissedPlanIds((prev) => [...prev, plan.id]);
notificationStore.success('Remediation plan dismissed');
};
// Map of finding_id -> latest remediation plan artifact
const plansByFindingId = createMemo(() => {
+ const dismissedPlanIdsSet = new Set(dismissedPlanIds());
const map = new Map<string, RemediationPlan>();
- for (const plan of remediationPlans()) {
+ for (const plan of aiIntelligenceStore.remediationPlans) {
+ if (dismissedPlanIdsSet.has(plan.id)) continue;
const existing = map.get(plan.finding_id);
if (!existing) {
map.set(plan.finding_id, plan);
@@ -132,12 +132,7 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {
// Load findings and remediation plans on mount
createEffect(() => {
aiIntelligenceStore.loadFindings();
- // Fetch remediation plan artifacts
- AIAPI.getRemediationPlans()
- .then((response: { plans: RemediationPlan[] }) => setRemediationPlans(response.plans))
- .catch((error) => {
- logger.warn('[FindingsPanel] Failed to load remediation plans', error);
- });
+ aiIntelligenceStore.loadRemediationPlans();
});
createEffect(() => {
diff --git a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
index ef837a8970..e4d6c05615 100644
--- a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
+++ b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
@@ -474,6 +474,12 @@ describe('aiFindingPresentation', () => {
expect(findingsPanelSource).toContain('manualControls.dismiss');
});
+ it('loads remediation artifacts through the shared Patrol store instead of probing the API directly', () => {
+ expect(findingsPanelSource).toContain('aiIntelligenceStore.loadRemediationPlans()');
+ expect(findingsPanelSource).toContain('aiIntelligenceStore.remediationPlans');
+ expect(findingsPanelSource).not.toContain('AIAPI.getRemediationPlans()');
+ });
+
it('routes same-severity ordering through the shared patrol runtime sort helper', () => {
expect(findingsPanelSource).toContain('getFindingActiveRuntimeSortOrder(a)');
expect(findingsPanelSource).toContain('getFindingActiveRuntimeSortOrder(b)');
diff --git a/frontend-modern/src/components/shared/PulseDataGrid.tsx b/frontend-modern/src/components/shared/PulseDataGrid.tsx
index d6eb03b5f1..ffba7a8cb6 100644
--- a/frontend-modern/src/components/shared/PulseDataGrid.tsx
+++ b/frontend-modern/src/components/shared/PulseDataGrid.tsx
@@ -9,6 +9,7 @@ import {
} from '@/components/shared/Table';
import {
getPulseDataGridAlignClass,
+ getPulseDataGridWidthAttr,
isPulseDataGridInteractiveTarget,
type PulseDataGridProps,
} from './pulseDataGridModel';
@@ -41,17 +42,8 @@ export function PulseDataGrid<T>(props: PulseDataGridProps<T>) {
return (
<div class={`overflow-hidden rounded-md border border-border bg-surface ${local.class || ''}`}>
- <div
- class="overflow-x-auto"
- style={{
- '-webkit-overflow-scrolling': 'touch',
- 'scrollbar-width': 'none', // Firefox
- '-ms-overflow-style': 'none', // IE 10+
- }}
- >
- <style>{`.overflow-x-auto::-webkit-scrollbar { display: none; }`}</style>
-
- <Table class="w-full border-collapse" style={{ 'min-width': grid.effectiveMinWidth() }}>
+ <div class="overflow-x-auto touch-scroll scrollbar-hide">
+ <Table class="w-full border-collapse" width={grid.effectiveWidthAttr()}>
<TableHeader class="bg-surface-alt border-b border-border">
<TableRow>
<For each={local.columns}>
@@ -63,7 +55,7 @@ export function PulseDataGrid<T>(props: PulseDataGridProps<T>) {
${getPulseDataGridAlignClass(col.align)}
${col.hiddenOnMobile ? 'hidden sm:table-cell' : ''}
`}
- style={col.width ? { width: col.width } : {}}
+ width={getPulseDataGridWidthAttr(col.width)}
>
{col.label}
</TableHead>
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index 3b632b67cb..6a8da3ef16 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -1019,7 +1019,11 @@ describe('shared primitive guardrails', () => {
it('keeps pulse data grid on shell, runtime, and model owners', () => {
expect(pulseDataGridSource).toContain('usePulseDataGridState');
expect(pulseDataGridSource).toContain('getPulseDataGridAlignClass');
+ expect(pulseDataGridSource).toContain('getPulseDataGridWidthAttr');
expect(pulseDataGridSource).toContain('isPulseDataGridInteractiveTarget');
+ expect(pulseDataGridSource).toContain('scrollbar-hide');
+ expect(pulseDataGridSource).not.toContain('style={{');
+ expect(pulseDataGridSource).not.toContain('style={');
expect(pulseDataGridSource).not.toContain('useBreakpoint');
expect(pulseDataGridSource).not.toContain('createStore');
expect(pulseDataGridSource).not.toContain('target.closest(');
@@ -1030,6 +1034,7 @@ describe('shared primitive guardrails', () => {
expect(pulseDataGridStateSource).toContain('reconcile(');
expect(pulseDataGridModelSource).toContain('export const getPulseDataGridAlignClass');
+ expect(pulseDataGridModelSource).toContain('export const getPulseDataGridWidthAttr');
expect(pulseDataGridModelSource).toContain('export const isPulseDataGridInteractiveTarget');
expect(pulseDataGridModelSource).toContain('target.closest(');
});
diff --git a/frontend-modern/src/components/shared/Table.tsx b/frontend-modern/src/components/shared/Table.tsx
index 2b57c5fc20..f216b2c586 100644
--- a/frontend-modern/src/components/shared/Table.tsx
+++ b/frontend-modern/src/components/shared/Table.tsx
@@ -4,6 +4,7 @@ export interface TableProps extends JSX.HTMLAttributes<HTMLTableElement> {
wrapperClass?: string;
wrapperProps?: JSX.HTMLAttributes<HTMLDivElement>;
wrapperRef?: (el: HTMLDivElement) => void;
+ width?: string | number;
}
export function Table(props: TableProps) {
@@ -75,6 +76,7 @@ export function TableRow(props: TableRowProps) {
export type TableHeadProps = JSX.HTMLAttributes<HTMLTableCellElement> & {
colSpan?: number;
colspan?: number;
+ width?: string | number;
};
export function TableHead(props: TableHeadProps) {
@@ -92,6 +94,7 @@ export function TableHead(props: TableHeadProps) {
export type TableCellProps = JSX.HTMLAttributes<HTMLTableCellElement> & {
colSpan?: number;
colspan?: number;
+ width?: string | number;
};
export function TableCell(props: TableCellProps) {
diff --git a/frontend-modern/src/components/shared/__tests__/PulseDataGrid.test.tsx b/frontend-modern/src/components/shared/__tests__/PulseDataGrid.test.tsx
index 86f7d1c792..93e293c058 100644
--- a/frontend-modern/src/components/shared/__tests__/PulseDataGrid.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/PulseDataGrid.test.tsx
@@ -20,7 +20,11 @@ describe('PulseDataGrid', () => {
it('keeps the shared pulse data grid on shell, runtime, and model owners', () => {
expect(pulseDataGridSource).toContain('usePulseDataGridState');
expect(pulseDataGridSource).toContain('getPulseDataGridAlignClass');
+ expect(pulseDataGridSource).toContain('getPulseDataGridWidthAttr');
expect(pulseDataGridSource).toContain('isPulseDataGridInteractiveTarget');
+ expect(pulseDataGridSource).toContain('scrollbar-hide');
+ expect(pulseDataGridSource).not.toContain('style={{');
+ expect(pulseDataGridSource).not.toContain('style={');
expect(pulseDataGridSource).not.toContain('useBreakpoint');
expect(pulseDataGridSource).not.toContain('createStore');
expect(pulseDataGridSource).not.toContain('target.closest(');
@@ -31,6 +35,7 @@ describe('PulseDataGrid', () => {
expect(pulseDataGridStateSource).toContain('reconcile(');
expect(pulseDataGridModelSource).toContain('export const getPulseDataGridAlignClass');
+ expect(pulseDataGridModelSource).toContain('export const getPulseDataGridWidthAttr');
expect(pulseDataGridModelSource).toContain('export const isPulseDataGridInteractiveTarget');
expect(pulseDataGridModelSource).toContain('target.closest(');
expect(tableSource).toContain('customDividePattern');
diff --git a/frontend-modern/src/components/shared/pulseDataGridModel.ts b/frontend-modern/src/components/shared/pulseDataGridModel.ts
index 6fe49711ef..e288021d5a 100644
--- a/frontend-modern/src/components/shared/pulseDataGridModel.ts
+++ b/frontend-modern/src/components/shared/pulseDataGridModel.ts
@@ -71,6 +71,18 @@ export const getPulseDataGridAlignClass = (align?: 'left' | 'center' | 'right')
}
};
+export const getPulseDataGridWidthAttr = (width?: string): string | undefined => {
+ const trimmed = width?.trim();
+ if (!trimmed) return undefined;
+ if (/^\d+(\.\d+)?px$/.test(trimmed)) {
+ return trimmed.slice(0, -2);
+ }
+ if (/^\d+(\.\d+)?%$/.test(trimmed) || /^\d+(\.\d+)?$/.test(trimmed)) {
+ return trimmed;
+ }
+ return undefined;
+};
+
export const isPulseDataGridInteractiveTarget = (target: EventTarget | null) =>
target instanceof Element &&
Boolean(
diff --git a/frontend-modern/src/components/shared/usePulseDataGridState.ts b/frontend-modern/src/components/shared/usePulseDataGridState.ts
index b7476a4b06..1c7bbfbd36 100644
--- a/frontend-modern/src/components/shared/usePulseDataGridState.ts
+++ b/frontend-modern/src/components/shared/usePulseDataGridState.ts
@@ -1,7 +1,11 @@
import { createEffect, createMemo } from 'solid-js';
import { createStore, reconcile } from 'solid-js/store';
import { useBreakpoint } from '@/hooks/useBreakpoint';
-import type { PulseDataGridProps, PulseDataGridStableRow } from './pulseDataGridModel';
+import {
+ getPulseDataGridWidthAttr,
+ type PulseDataGridProps,
+ type PulseDataGridStableRow,
+} from './pulseDataGridModel';
type PulseDataGridStateOptions<T> = Pick<
PulseDataGridProps<T>,
@@ -19,6 +23,8 @@ export function usePulseDataGridState<T>(options: PulseDataGridStateOptions<T>)
return options.desktopMinWidth ?? '800px';
});
+ const effectiveWidthAttr = createMemo(() => getPulseDataGridWidthAttr(effectiveMinWidth()));
+
createEffect(() => {
setStableRows(
reconcile(
@@ -33,6 +39,7 @@ export function usePulseDataGridState<T>(options: PulseDataGridStateOptions<T>)
return {
effectiveMinWidth,
+ effectiveWidthAttr,
stableRows,
};
}
diff --git a/frontend-modern/src/pages/Alerts.tsx b/frontend-modern/src/pages/Alerts.tsx
index 581af1a969..b85b6c333c 100644
--- a/frontend-modern/src/pages/Alerts.tsx
+++ b/frontend-modern/src/pages/Alerts.tsx
@@ -391,10 +391,7 @@ export function Alerts() {
<Show when={flatTabs().length > 0}>
<div class="lg:hidden border-b border-border">
<div class="p-1">
- <div
- class="flex rounded-md bg-surface-hover p-0.5 w-full overflow-x-auto"
- style="-webkit-overflow-scrolling: touch;"
- >
+ <div class="flex w-full overflow-x-auto rounded-md bg-surface-hover p-0.5 touch-scroll scrollbar-hide">
<For each={flatTabs()}>
{(tab) => (
<button
diff --git a/frontend-modern/src/pages/__tests__/Alerts.helpers.test.ts b/frontend-modern/src/pages/__tests__/Alerts.helpers.test.ts
index 0552f4736a..18eb50bdcf 100644
--- a/frontend-modern/src/pages/__tests__/Alerts.helpers.test.ts
+++ b/frontend-modern/src/pages/__tests__/Alerts.helpers.test.ts
@@ -227,6 +227,9 @@ describe('tab path helpers', () => {
"import { HistoryTab } from '@/features/alerts/tabs/HistoryTab';",
);
expect(alertsPageSource).toContain('getAlertsTabGroups({ readOnly: readOnlySession() })');
+ expect(alertsPageSource).toContain('touch-scroll');
+ expect(alertsPageSource).toContain('scrollbar-hide');
+ expect(alertsPageSource).not.toContain('style="-webkit-overflow-scrolling: touch;"');
expect(alertsPageSource).not.toContain('const loadAlertConfiguration = async');
expect(alertsPageSource).not.toContain('const FACTORY_GUEST_DEFAULTS =');
expect(alertsConfigurationSurfaceSource).toContain(
diff --git a/frontend-modern/src/pages/__tests__/Alerts.readOnly.test.tsx b/frontend-modern/src/pages/__tests__/Alerts.readOnly.test.tsx
index 863a3d7977..b731acecd4 100644
--- a/frontend-modern/src/pages/__tests__/Alerts.readOnly.test.tsx
+++ b/frontend-modern/src/pages/__tests__/Alerts.readOnly.test.tsx
@@ -2,6 +2,7 @@ import { cleanup, render, screen, waitFor } from '@solidjs/testing-library';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { Alerts } from '@/pages/Alerts';
+import alertsPageSource from '@/pages/Alerts.tsx?raw';
const navigateSpy = vi.hoisted(() => vi.fn());
const presentationPolicyIsReadOnlyMock = vi.hoisted(() => vi.fn(() => false));
@@ -118,6 +119,12 @@ describe('Alerts read-only presentation', () => {
afterEach(() => cleanup());
+ it('keeps the mobile tab shell on shared scroll classes instead of inline styles', () => {
+ expect(alertsPageSource).toContain('touch-scroll');
+ expect(alertsPageSource).toContain('scrollbar-hide');
+ expect(alertsPageSource).not.toContain('style="-webkit-overflow-scrolling: touch;"');
+ });
+
it('hides alerts management affordances in read-only sessions', async () => {
presentationPolicyIsReadOnlyMock.mockReturnValue(true);
activationStateMock.mockReturnValue('pending_review');
diff --git a/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts b/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts
index 78786e80a9..ec82c35519 100644
--- a/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts
+++ b/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts
@@ -3,6 +3,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
vi.mock('@/api/ai', () => ({
AIAPI: {
getUnifiedFindings: vi.fn(),
+ getRemediationPlans: vi.fn(),
getPendingApprovals: vi.fn(),
getIntelligenceSummary: vi.fn(),
getCorrelations: vi.fn(),
@@ -387,6 +388,16 @@ describe('aiIntelligenceStore', () => {
expect(aiIntelligenceStore.approvalsError).toBeNull();
});
+ it('fails remediation plan loading closed in public demo mode', async () => {
+ vi.mocked(presentationPolicyIsDemoMode).mockReturnValue(true);
+
+ await aiIntelligenceStore.loadRemediationPlans();
+
+ expect(AIAPI.getRemediationPlans).not.toHaveBeenCalled();
+ expect(aiIntelligenceStore.remediationPlans).toEqual([]);
+ expect(aiIntelligenceStore.plansError).toBeNull();
+ });
+
it('drops expired approvals from Patrol counts and restores needs-attention immediately', async () => {
vi.useFakeTimers();
vi.setSystemTime(new Date('2026-03-01T00:05:00Z'));
diff --git a/frontend-modern/src/stores/aiIntelligence.ts b/frontend-modern/src/stores/aiIntelligence.ts
index 324f4c5181..8ac6d4e86a 100644
--- a/frontend-modern/src/stores/aiIntelligence.ts
+++ b/frontend-modern/src/stores/aiIntelligence.ts
@@ -339,6 +339,11 @@ export const aiIntelligenceStore = {
async loadRemediationPlans() {
setPlansLoading(true);
setPlansError(null);
+ if (presentationPolicyIsDemoMode()) {
+ setRemediationPlans([]);
+ setPlansLoading(false);
+ return;
+ }
try {
const resp = await AIAPI.getRemediationPlans();
setRemediationPlans(resp?.plans || []);