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.

Add guided hardening actions to security overview

rcourtman50d027568d21
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 6c8602dbf3..9bd0bf94f1 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -329,6 +329,15 @@ the shared shipped-doc helper in `frontend-modern/src/utils/docsLinks.ts`
instead of hardcoding GitHub `main` URLs that can drift from the running
build, and `tests/integration/tests/20-local-doc-links.spec.ts` must keep
browser proof on those settings-shell surfaces.
+That same settings-shell boundary now also owns the remediation framing for
+Security Overview itself. `SecurityOverviewPanel.tsx` may not stop at a score
+card and static best-practices copy once low-risk security debt has been
+demoted out of the global banner; it must render explicit next-step hardening
+actions on the canonical settings shell, source those actions from the shared
+security presentation owner, and keep direct operator links pointed at the
+owning auth, API-access, or shipped security-guide surface. The canonical
+proof for that shell framing remains
+`frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts`.
The same reporting catalog ownership now also governs the operator resource-
selection cap for performance reports. `ReportingPanel.tsx` and
`ResourcePicker.tsx` may present or enforce that limit, but they must receive
diff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.md
index 9042fb38ab..bc33aa663e 100644
--- a/docs/release-control/v6/internal/subsystems/security-privacy.md
+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md
@@ -163,6 +163,7 @@ That same rule also applies inside shipped security guidance itself:
not bounce the operator back to GitHub `main` for section references that the
running build already owns locally.
That same governed settings trust boundary now also includes
+`frontend-modern/src/components/Settings/SecurityOverviewPanel.tsx`,
`frontend-modern/src/components/Settings/QuickSecuritySetup.tsx`,
`frontend-modern/src/components/Settings/SecurityPostureSummary.tsx`,
`frontend-modern/src/components/Settings/SSOProviderTypeIcon.tsx`,
@@ -192,6 +193,13 @@ HTTP, but private authenticated runtimes that are only missing optional
hardening controls such as HTTPS on localhost or an API token must route that
guidance through the governed Security Overview posture surfaces instead of
covering the primary app chrome with a persistent warning.
+That same Security Overview surface must stay action-oriented once those
+low-risk states are demoted out of the global banner:
+`frontend-modern/src/components/Settings/SecurityOverviewPanel.tsx` and
+`frontend-modern/src/utils/securityScorePresentation.ts` must render explicit
+next-step hardening actions that point to the owning auth, API-access, or
+security-guidance surface rather than dropping operators onto a generic score
+without a remediation path.
That same shared security transport boundary must stay under explicit proof
routing on both sides: `frontend-modern/src/api/security.ts`,
`internal/api/security.go`, `internal/api/security_tokens.go`, and
diff --git a/frontend-modern/src/components/Settings/SecurityOverviewPanel.tsx b/frontend-modern/src/components/Settings/SecurityOverviewPanel.tsx
index 31b512c390..d1c9e1e355 100644
--- a/frontend-modern/src/components/Settings/SecurityOverviewPanel.tsx
+++ b/frontend-modern/src/components/Settings/SecurityOverviewPanel.tsx
@@ -1,9 +1,16 @@
-import { Component, Show, Accessor } from 'solid-js';
+import { Component, Show, Accessor, For, createMemo } from 'solid-js';
+import { CalloutCard } from '@/components/shared/CalloutCard';
import SettingsPanel from '@/components/shared/SettingsPanel';
-import { PROXY_AUTH_DOC_URL } from '@/utils/docsLinks';
+import { PROXY_AUTH_DOC_URL, SECURITY_DOC_URL } from '@/utils/docsLinks';
import { SecurityPostureSummary } from './SecurityPostureSummary';
+import { settingsTabPath } from './settingsNavigationModel';
import Shield from 'lucide-solid/icons/shield';
import Info from 'lucide-solid/icons/info';
+import AlertTriangle from 'lucide-solid/icons/alert-triangle';
+import {
+ getSecurityHardeningActions,
+ type SecurityHardeningAction,
+} from '@/utils/securityScorePresentation';
interface SecurityStatusInfo {
hasAuthentication: boolean;
@@ -29,6 +36,52 @@ interface SecurityOverviewPanelProps {
}
export const SecurityOverviewPanel: Component<SecurityOverviewPanelProps> = (props) => {
+ const hardeningActions = createMemo(() =>
+ props.securityStatus() ? getSecurityHardeningActions(props.securityStatus()!) : [],
+ );
+ const criticalHardeningActions = createMemo(
+ () => hardeningActions().filter((action) => action.severity === 'critical').length,
+ );
+ const recommendedHardeningActions = createMemo(
+ () => hardeningActions().filter((action) => action.severity === 'recommended').length,
+ );
+ const hardeningTone = createMemo(() =>
+ criticalHardeningActions() > 0 ? 'danger' : 'info',
+ );
+ const hardeningTitle = createMemo(() =>
+ criticalHardeningActions() > 0 ? 'Hardening priorities' : 'Recommended hardening steps',
+ );
+ const hardeningDescription = createMemo(() => {
+ if (criticalHardeningActions() > 0) {
+ return `Resolve the ${criticalHardeningActions() === 1 ? 'critical exposure' : `${criticalHardeningActions()} critical exposures`} below before using this Pulse instance for live infrastructure.`;
+ }
+
+ return 'Authentication is enabled and this instance appears private, but it still needs a few production hardening steps.';
+ });
+ const actionLinkFor = (action: SecurityHardeningAction) => {
+ switch (action.key) {
+ case 'enable-authentication':
+ return {
+ href: settingsTabPath('security-auth'),
+ label: 'Open Authentication',
+ external: false,
+ } as const;
+ case 'protect-exports':
+ case 'create-api-token':
+ return {
+ href: settingsTabPath('api'),
+ label: 'Open API Access',
+ external: false,
+ } as const;
+ case 'configure-https':
+ return {
+ href: SECURITY_DOC_URL,
+ label: 'Open security guide',
+ external: false,
+ } as const;
+ }
+ };
+
return (
<SettingsPanel
title="Security Overview"
@@ -68,6 +121,67 @@ export const SecurityOverviewPanel: Component<SecurityOverviewPanelProps> = (pro
<SecurityPostureSummary status={props.securityStatus()!} embedded />
</Show>
+ <Show when={!props.securityStatusLoading() && hardeningActions().length > 0}>
+ <CalloutCard
+ tone={hardeningTone()}
+ title={hardeningTitle()}
+ description={hardeningDescription()}
+ icon={
+ criticalHardeningActions() > 0 ? (
+ <AlertTriangle class="h-5 w-5" />
+ ) : (
+ <Info class="h-5 w-5" />
+ )
+ }
+ class="space-y-4"
+ >
+ <div class="grid gap-3 lg:grid-cols-2">
+ <For each={hardeningActions()}>
+ {(action) => {
+ const actionLink = actionLinkFor(action);
+ return (
+ <div class="rounded-md border border-border bg-surface px-4 py-3">
+ <div class="flex items-start justify-between gap-3">
+ <div class="min-w-0 flex-1">
+ <div class="flex flex-wrap items-center gap-2">
+ <h3 class="text-sm font-semibold text-base-content">{action.title}</h3>
+ <span
+ class={`inline-flex rounded-full px-2 py-0.5 text-[11px] font-semibold uppercase tracking-wide ${
+ action.severity === 'critical'
+ ? 'bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200'
+ : 'bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200'
+ }`}
+ >
+ {action.severity === 'critical' ? 'Act now' : 'Recommended'}
+ </span>
+ </div>
+ <p class="mt-2 text-sm text-muted">{action.description}</p>
+ </div>
+ </div>
+ <div class="mt-3 flex flex-wrap items-center gap-3">
+ <a
+ href={actionLink.href}
+ target={actionLink.external ? '_blank' : undefined}
+ rel={actionLink.external ? 'noreferrer' : undefined}
+ class="inline-flex min-h-10 items-center rounded-md border border-border bg-surface-alt px-3 py-2 text-sm font-medium text-base-content transition-colors hover:bg-surface-hover"
+ >
+ {actionLink.label}
+ </a>
+ </div>
+ </div>
+ );
+ }}
+ </For>
+ </div>
+ <Show when={recommendedHardeningActions() > 0}>
+ <p class="text-xs text-muted">
+ Recommended items improve production readiness even when the current runtime is only
+ being used locally.
+ </p>
+ </Show>
+ </CalloutCard>
+ </Show>
+
<Show when={!props.securityStatusLoading() && props.securityStatus()?.hasProxyAuth}>
<div class="rounded-md border border-blue-200 dark:border-blue-800 overflow-hidden bg-blue-50/60 dark:bg-blue-950/40">
<div class="bg-blue-50 dark:bg-blue-900 px-6 py-4 border-b border-blue-200 dark:border-blue-700">
diff --git a/frontend-modern/src/components/Settings/__tests__/SecurityOverviewPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/SecurityOverviewPanel.test.tsx
new file mode 100644
index 0000000000..6443da9556
--- /dev/null
+++ b/frontend-modern/src/components/Settings/__tests__/SecurityOverviewPanel.test.tsx
@@ -0,0 +1,57 @@
+import { describe, expect, it } from 'vitest';
+import { render, screen } from '@solidjs/testing-library';
+import { SecurityOverviewPanel } from '../SecurityOverviewPanel';
+
+describe('SecurityOverviewPanel', () => {
+ it('shows calm hardening guidance for private authenticated setups', () => {
+ render(() => (
+ <SecurityOverviewPanel
+ securityStatus={() => ({
+ hasAuthentication: true,
+ apiTokenConfigured: false,
+ exportProtected: true,
+ unprotectedExportAllowed: false,
+ hasHTTPS: false,
+ hasAuditLogging: false,
+ requiresAuth: true,
+ publicAccess: false,
+ isPrivateNetwork: true,
+ clientIP: '127.0.0.1',
+ })}
+ securityStatusLoading={() => false}
+ />
+ ));
+
+ expect(screen.getByText('Recommended hardening steps')).toBeInTheDocument();
+ expect(screen.getByText('Plan HTTPS before live use')).toBeInTheDocument();
+ expect(screen.getByText('Create an API token')).toBeInTheDocument();
+ expect(screen.getAllByText('Open API Access')[0]).toHaveAttribute('href', '/settings/security/api');
+ expect(screen.getByText('Open security guide')).toHaveAttribute('href', '/docs/SECURITY.md');
+ expect(screen.getAllByText('Recommended')).toHaveLength(2);
+ });
+
+ it('shows critical hardening priorities for exposed setups', () => {
+ render(() => (
+ <SecurityOverviewPanel
+ securityStatus={() => ({
+ hasAuthentication: false,
+ apiTokenConfigured: false,
+ exportProtected: false,
+ unprotectedExportAllowed: true,
+ hasHTTPS: false,
+ hasAuditLogging: false,
+ requiresAuth: false,
+ publicAccess: true,
+ isPrivateNetwork: false,
+ })}
+ securityStatusLoading={() => false}
+ />
+ ));
+
+ expect(screen.getByText('Hardening priorities')).toBeInTheDocument();
+ expect(screen.getByText('Enable authentication')).toBeInTheDocument();
+ expect(screen.getByText('Protect exports')).toBeInTheDocument();
+ expect(screen.getByText('Enable HTTPS for public access')).toBeInTheDocument();
+ expect(screen.getAllByText('Act now')).toHaveLength(3);
+ });
+});
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
index 24c041f4ee..d0d227f9d2 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
@@ -1299,6 +1299,12 @@ describe('Settings architecture guardrails', () => {
expect(aiRuntimeControlsSectionSource).toContain('TERMS_DOC_URL');
expect(securityOverviewPanelSource).toContain('@/utils/docsLinks');
expect(securityOverviewPanelSource).toContain('PROXY_AUTH_DOC_URL');
+ expect(securityOverviewPanelSource).toContain('SECURITY_DOC_URL');
+ expect(securityOverviewPanelSource).toContain('getSecurityHardeningActions');
+ expect(securityOverviewPanelSource).toContain("label: 'Open API Access'");
+ expect(securityOverviewPanelSource).toContain("label: 'Open security guide'");
+ expect(securityOverviewPanelSource).toContain("tone={hardeningTone()}");
+ expect(securityOverviewPanelSource).toContain("criticalHardeningActions() > 0 ? 'danger' : 'info'");
expect(selfHostedCommercialActivationSectionSource).toContain('@/utils/docsLinks');
expect(selfHostedCommercialActivationSectionSource).toContain('TERMS_DOC_URL');
expect(apiTokenManagerModelSource).toContain('@/utils/docsLinks');
diff --git a/frontend-modern/src/utils/__tests__/securityScorePresentation.test.ts b/frontend-modern/src/utils/__tests__/securityScorePresentation.test.ts
index e3929bf4ec..f43f0c7f03 100644
--- a/frontend-modern/src/utils/__tests__/securityScorePresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/securityScorePresentation.test.ts
@@ -2,6 +2,7 @@ import { describe, expect, it } from 'vitest';
import {
getSecurityFeatureCardPresentation,
getSecurityFeatureStatePresentation,
+ getSecurityHardeningActions,
getSecurityNetworkAccessSubtitle,
getSecurityPostureItems,
getSecurityScoreIconComponent,
@@ -148,6 +149,46 @@ describe('securityScorePresentation', () => {
).toBe(true);
});
+ it('returns recommended hardening steps for private authenticated setups', () => {
+ expect(
+ getSecurityHardeningActions({
+ hasAuthentication: true,
+ apiTokenConfigured: false,
+ exportProtected: true,
+ hasAuditLogging: false,
+ requiresAuth: true,
+ publicAccess: false,
+ isPrivateNetwork: true,
+ hasHTTPS: false,
+ }),
+ ).toEqual([
+ expect.objectContaining({
+ key: 'configure-https',
+ severity: 'recommended',
+ }),
+ expect.objectContaining({
+ key: 'create-api-token',
+ severity: 'recommended',
+ }),
+ ]);
+ });
+
+ it('returns critical hardening steps for exposed setups', () => {
+ expect(
+ getSecurityHardeningActions({
+ hasAuthentication: false,
+ apiTokenConfigured: false,
+ exportProtected: false,
+ unprotectedExportAllowed: true,
+ hasAuditLogging: false,
+ requiresAuth: false,
+ publicAccess: true,
+ isPrivateNetwork: false,
+ hasHTTPS: false,
+ }).map((action) => action.key),
+ ).toEqual(['enable-authentication', 'protect-exports', 'configure-https']);
+ });
+
it('returns canonical yes/no feature-state presentation', () => {
expect(getSecurityFeatureStatePresentation(true)).toEqual({
label: 'Yes',
diff --git a/frontend-modern/src/utils/securityScorePresentation.ts b/frontend-modern/src/utils/securityScorePresentation.ts
index e4cab3b0e0..aef4bb21b1 100644
--- a/frontend-modern/src/utils/securityScorePresentation.ts
+++ b/frontend-modern/src/utils/securityScorePresentation.ts
@@ -45,6 +45,19 @@ export interface SecurityFeatureCardPresentation {
criticalLabelClassName: string;
}
+export type SecurityHardeningActionKey =
+ | 'enable-authentication'
+ | 'protect-exports'
+ | 'configure-https'
+ | 'create-api-token';
+
+export interface SecurityHardeningAction {
+ key: SecurityHardeningActionKey;
+ severity: 'critical' | 'recommended';
+ title: string;
+ description: string;
+}
+
export interface SecurityPostureStatus {
hasAuthentication: boolean;
ssoEnabled?: boolean;
@@ -253,6 +266,62 @@ export function getSecurityFeatureCardPresentation(options: {
};
}
+export function getSecurityHardeningActions(
+ status: SecurityPostureStatus,
+): SecurityHardeningAction[] {
+ const actions: SecurityHardeningAction[] = [];
+
+ if (!status.hasAuthentication) {
+ actions.push({
+ key: 'enable-authentication',
+ severity: 'critical',
+ title: 'Enable authentication',
+ description:
+ 'Anyone who can reach this Pulse instance can sign in without a password boundary until authentication is configured.',
+ });
+ }
+
+ if (!status.exportProtected || status.unprotectedExportAllowed) {
+ actions.push({
+ key: 'protect-exports',
+ severity: 'critical',
+ title: 'Protect exports',
+ description:
+ 'Backup and export flows are currently allowed without token-backed protection. Lock them down before using this instance for real infrastructure data.',
+ });
+ }
+
+ if (status.publicAccess && !status.hasHTTPS) {
+ actions.push({
+ key: 'configure-https',
+ severity: 'critical',
+ title: 'Enable HTTPS for public access',
+ description:
+ 'This Pulse instance is reachable from a public network and still serves over HTTP. Put it behind TLS before exposing it beyond your private network.',
+ });
+ } else if (!status.hasHTTPS) {
+ actions.push({
+ key: 'configure-https',
+ severity: 'recommended',
+ title: 'Plan HTTPS before live use',
+ description:
+ 'Local HTTP is acceptable for development, but production access should terminate TLS at a reverse proxy before operators use this instance for live infrastructure.',
+ });
+ }
+
+ if (status.hasAuthentication && !status.apiTokenConfigured) {
+ actions.push({
+ key: 'create-api-token',
+ severity: 'recommended',
+ title: 'Create an API token',
+ description:
+ 'Scoped API tokens protect export and automation flows without reusing the interactive admin password.',
+ });
+ }
+
+ return actions;
+}
+
export function getSecurityPostureItems(status: SecurityPostureStatus): SecurityPostureItem[] {
return [
{