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 misleading security warning copy

rcourtman059cca5125ec
diff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.md
index 0ba98cc192..0d5705e85d 100644
--- a/docs/release-control/v6/internal/subsystems/security-privacy.md
+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md
@@ -173,6 +173,15 @@ That same governed settings trust boundary now also includes
copy, security posture scoring, audit-log wording, audit-webhook wording, and
SSO provider-type presentation remain part of the governed security trust
surface instead of floating as unowned settings helpers.
+That same governed security-score presentation boundary also owns the
+operator-facing low-score warning copy used by the top-level runtime banner:
+`frontend-modern/src/utils/securityScorePresentation.ts` must describe the
+actual missing controls surfaced by the current security posture, and it may
+only claim the instance is accessible without authentication when
+`hasAuthentication` is false. Authenticated local runtimes that are merely
+missing HTTPS, API tokens, or protected exports must not reuse the
+unauthenticated credential-exposure warning just because the aggregate score
+remains below the banner threshold.
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/SecurityWarning.tsx b/frontend-modern/src/components/SecurityWarning.tsx
index ccf888d80e..b2d679874f 100644
--- a/frontend-modern/src/components/SecurityWarning.tsx
+++ b/frontend-modern/src/components/SecurityWarning.tsx
@@ -113,6 +113,9 @@ export const SecurityWarning: Component = () => {
score: scorePercentage(),
publicAccess: status()!.publicAccess || false,
hasAuthentication: status()!.hasAuthentication,
+ apiTokenConfigured: status()!.hasAPIToken,
+ exportProtected: status()!.exportProtected,
+ hasHTTPS: status()!.hasHTTPS,
});
return (
diff --git a/frontend-modern/src/components/__tests__/SecurityWarning.test.tsx b/frontend-modern/src/components/__tests__/SecurityWarning.test.tsx
index c6f73f75fc..e51aec3a61 100644
--- a/frontend-modern/src/components/__tests__/SecurityWarning.test.tsx
+++ b/frontend-modern/src/components/__tests__/SecurityWarning.test.tsx
@@ -54,6 +54,14 @@ describe('SecurityWarning', () => {
expect(screen.getByText(/Security score:/i)).toBeInTheDocument();
});
+ expect(
+ screen.getByText(
+ 'Authentication is enabled, but this Pulse instance is still missing HTTPS, an API token, and protected exports.',
+ ),
+ ).toBeInTheDocument();
+ expect(
+ screen.queryByText(/accessible without authentication/i),
+ ).not.toBeInTheDocument();
expect(screen.getByRole('link', { name: 'Learn More' })).toHaveAttribute(
'href',
'/docs/SECURITY.md',
diff --git a/frontend-modern/src/utils/__tests__/securityScorePresentation.test.ts b/frontend-modern/src/utils/__tests__/securityScorePresentation.test.ts
index 53fdf05254..f0fc4510e4 100644
--- a/frontend-modern/src/utils/__tests__/securityScorePresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/securityScorePresentation.test.ts
@@ -51,6 +51,9 @@ describe('securityScorePresentation', () => {
score: 40,
publicAccess: true,
hasAuthentication: false,
+ apiTokenConfigured: false,
+ exportProtected: false,
+ hasHTTPS: false,
}),
).toMatchObject({
background: 'bg-red-50 dark:bg-red-900',
@@ -65,6 +68,9 @@ describe('securityScorePresentation', () => {
score: 35,
publicAccess: false,
hasAuthentication: false,
+ apiTokenConfigured: false,
+ exportProtected: false,
+ hasHTTPS: false,
}),
).toMatchObject({
background: 'bg-red-50 dark:bg-red-900',
@@ -79,6 +85,9 @@ describe('securityScorePresentation', () => {
score: 60,
publicAccess: false,
hasAuthentication: false,
+ apiTokenConfigured: false,
+ exportProtected: false,
+ hasHTTPS: false,
}),
).toMatchObject({
background: 'bg-yellow-50 dark:bg-yellow-900',
@@ -87,6 +96,19 @@ describe('securityScorePresentation', () => {
});
});
+ it('describes missing controls when authentication is enabled', () => {
+ expect(
+ getSecurityWarningPresentation({
+ score: 60,
+ publicAccess: false,
+ hasAuthentication: true,
+ apiTokenConfigured: false,
+ exportProtected: true,
+ hasHTTPS: false,
+ }).message,
+ ).toBe('Authentication is enabled, but this Pulse instance is still missing HTTPS and an API token.');
+ });
+
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 beac443f0e..a0d07071b9 100644
--- a/frontend-modern/src/utils/securityScorePresentation.ts
+++ b/frontend-modern/src/utils/securityScorePresentation.ts
@@ -113,6 +113,9 @@ export function getSecurityWarningPresentation(options: {
score: number;
publicAccess: boolean;
hasAuthentication: boolean;
+ apiTokenConfigured: boolean;
+ exportProtected: boolean;
+ hasHTTPS?: boolean;
}): SecurityWarningPresentation {
if (options.publicAccess && !options.hasAuthentication) {
return {
@@ -125,6 +128,38 @@ export function getSecurityWarningPresentation(options: {
}
const posture = getSecurityScorePresentation(options.score);
+ const missingControls: string[] = [];
+ if (!options.hasHTTPS) {
+ missingControls.push('HTTPS');
+ }
+ if (!options.apiTokenConfigured) {
+ missingControls.push('an API token');
+ }
+ if (!options.exportProtected) {
+ missingControls.push('protected exports');
+ }
+
+ const formatList = (items: string[]): string => {
+ if (items.length <= 1) {
+ return items[0] ?? 'required security controls';
+ }
+ if (items.length === 2) {
+ return `${items[0]} and ${items[1]}`;
+ }
+ return `${items.slice(0, -1).join(', ')}, and ${items[items.length - 1]}`;
+ };
+
+ let message = 'Review the remaining security settings before using this instance for live infrastructure.';
+ if (!options.hasAuthentication) {
+ message =
+ 'Authentication is disabled. Anyone who can reach this Pulse instance can access stored infrastructure credentials.';
+ } else if (missingControls.length > 0) {
+ const missingSummary = formatList(missingControls);
+ message = options.publicAccess
+ ? `This Pulse instance is reachable from a public network and is still missing ${missingSummary}.`
+ : `Authentication is enabled, but this Pulse instance is still missing ${missingSummary}.`;
+ }
+
return {
background:
posture.label === 'Moderate'
@@ -134,8 +169,7 @@ export function getSecurityWarningPresentation(options: {
posture.label === 'Moderate'
? 'border-yellow-200 dark:border-yellow-800'
: 'border-red-200 dark:border-red-800',
- message:
- 'Your Pulse instance is accessible without authentication. Proxmox credentials could be exposed.',
+ message,
messageClass: 'text-base-content',
};
}