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.

Use a confirmed recovery passphrase for configuration exports

pulse-triage[bot]4abf8cbb1da1
diff --git a/docs/MIGRATION.md b/docs/MIGRATION.md
index f4164c9112..ecd80b550d 100644
--- a/docs/MIGRATION.md
+++ b/docs/MIGRATION.md
@@ -105,8 +105,10 @@ configuration import as proof of a complete multi-organisation migration.
1. Complete the [organisation and access checks](#confirm-organisation-and-access).
On the old server, sign in and open **Settings → System → Recovery →
Create Backup**. Use a strong, unique passphrase of at least 12 characters
- and store it separately from the downloaded file. With password login,
- choose **Use a custom passphrase** if you do not want to use that password.
+ and enter it again in **Confirm backup passphrase**. Use a different
+ passphrase from your Pulse or SSO login password: this encrypts the file,
+ not a sign-in check. Store it separately from the downloaded file; Pulse
+ cannot recover a forgotten passphrase.
Keep the old instance and your separate full-state backup until validation
is complete.
2. Install Pulse at the destination using the [installation guide](INSTALL.md).
@@ -118,8 +120,10 @@ configuration import as proof of a complete multi-organisation migration.
isolation for a full-state recovery trial too; give it separate restored
storage, never the source's live data volume.
3. If the destination already has useful settings, export them first. Open
- **Settings → System → Recovery → Restore Configuration**, select the file
- and enter its passphrase. Import replaces the included configuration and
+ **Settings → System → Recovery → Restore Backup**, select the file
+ and enter the original passphrase used for that file. Older backups still
+ accept the password or passphrase you chose when exporting, even if your
+ login password has since changed. Import replaces the included configuration and
API-token records; it does not merge them with the destination's records.
4. Check the result before changing DNS or agent addresses. A success message
establishes neither full recovery nor fresh monitoring. For a
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index cbbe333bb2..d02ffbf2e9 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -10459,10 +10459,33 @@ login credentials and agent enrolment state, and links the shipped migration
guide for complete scope and full-state recovery. Restore warns to back up the
destination and describes replacement of included settings and API-token records,
never a merge option. `RecoverySettingsPanel.test.tsx` covers the visible scope,
-existing dialog actions and passphrase defaults; desktop/narrow browser proof
+and existing dialog actions; desktop/narrow browser proof
must inspect the overview and follow both actions into the production dialogs.
Archive formats, server application and access authority do not change.
+All login configurations use the same backup-passphrase form. Export asks for a
+strong, unique passphrase of at least 12 characters, explicitly different from
+Pulse or SSO login credentials, and a second masked confirmation. This encrypts
+an archive; it is not a sign-in check. Neither the recovery overview nor Settings
+wiring selects a login-password mode. Both fields use `new-password` autofill
+semantics and explain separate storage and the lack of forgotten-passphrase
+recovery. The transfer flow rejects missing, short or nonmatching values before
+credential prompting or dispatch, preserves them for deliberate correction, and
+sends only the original, unchanged passphrase, never the confirmation. Pending
+controls remain locked; successful export, close and switching dialogs clear
+both fields. Import still accepts the original password/passphrase for old
+archives, not a newly changed login credential, with no confirmation or new
+minimum-length requirement.
+
+The transfer flow/dialog tests cover these validation, exact-byte, auth-mode,
+pending, explicit-correction and cleanup behaviours. Settings architecture and
+overview tests cover the removed auth-dependent wiring. The shipped migration
+guide matches the form and preserves older-archive guidance; its rendered access
+tests check both. Desktop/narrow browser proof must exercise typo rejection,
+explicit correction, an actual synthetic export download, original-passphrase
+import and the migration guide through their production consumers. This changes
+neither backend encryption/authorization nor existing archive formats.
+
The overview has its own `settings-recovery-overview` verification policy,
requiring `RecoverySettingsPanel.test.tsx`. That copy/action test is not transfer
safety proof: `settings-configuration-transfer` retains its existing dialog/flow
diff --git a/frontend-modern/public/docs/MIGRATION.md b/frontend-modern/public/docs/MIGRATION.md
index f4164c9112..ecd80b550d 100644
--- a/frontend-modern/public/docs/MIGRATION.md
+++ b/frontend-modern/public/docs/MIGRATION.md
@@ -105,8 +105,10 @@ configuration import as proof of a complete multi-organisation migration.
1. Complete the [organisation and access checks](#confirm-organisation-and-access).
On the old server, sign in and open **Settings → System → Recovery →
Create Backup**. Use a strong, unique passphrase of at least 12 characters
- and store it separately from the downloaded file. With password login,
- choose **Use a custom passphrase** if you do not want to use that password.
+ and enter it again in **Confirm backup passphrase**. Use a different
+ passphrase from your Pulse or SSO login password: this encrypts the file,
+ not a sign-in check. Store it separately from the downloaded file; Pulse
+ cannot recover a forgotten passphrase.
Keep the old instance and your separate full-state backup until validation
is complete.
2. Install Pulse at the destination using the [installation guide](INSTALL.md).
@@ -118,8 +120,10 @@ configuration import as proof of a complete multi-organisation migration.
isolation for a full-state recovery trial too; give it separate restored
storage, never the source's live data volume.
3. If the destination already has useful settings, export them first. Open
- **Settings → System → Recovery → Restore Configuration**, select the file
- and enter its passphrase. Import replaces the included configuration and
+ **Settings → System → Recovery → Restore Backup**, select the file
+ and enter the original passphrase used for that file. Older backups still
+ accept the password or passphrase you chose when exporting, even if your
+ login password has since changed. Import replaces the included configuration and
API-token records; it does not merge them with the destination's records.
4. Check the result before changing DNS or agent addresses. A success message
establishes neither full recovery nor fresh monitoring. For a
diff --git a/frontend-modern/src/components/Settings/BackupTransferDialogs.tsx b/frontend-modern/src/components/Settings/BackupTransferDialogs.tsx
index 9c2e68203f..abd192d62b 100644
--- a/frontend-modern/src/components/Settings/BackupTransferDialogs.tsx
+++ b/frontend-modern/src/components/Settings/BackupTransferDialogs.tsx
@@ -3,17 +3,15 @@ import { Card } from '@/components/shared/Card';
import { Dialog } from '@/components/shared/Dialog';
import { SectionHeader } from '@/components/shared/SectionHeader';
import { controlClass, formField, formHelpText, labelClass } from '@/components/shared/Form';
-import type { SecurityStatus as SecurityStatusInfo } from '@/types/config';
import { getAPITokenManagementLocationMessage } from '@/utils/apiTokenPresentation';
import { ExternalTextLink } from '@/components/shared/ExternalTextLink';
import { getShippedDocUrl } from '@/utils/docsLinks';
interface BackupTransferDialogsProps {
- securityStatus: Accessor<SecurityStatusInfo | null>;
exportPassphrase: Accessor<string>;
setExportPassphrase: (value: string) => void;
- useCustomPassphrase: Accessor<boolean>;
- setUseCustomPassphrase: (value: boolean) => void;
+ exportPassphraseConfirmation: Accessor<string>;
+ setExportPassphraseConfirmation: (value: string) => void;
importPassphrase: Accessor<string>;
setImportPassphrase: (value: string) => void;
importFile: Accessor<File | null>;
@@ -68,88 +66,48 @@ export const BackupTransferDialogs: Component<BackupTransferDialogsProps> = (pro
</Show>
<div class="space-y-4">
- <Show when={props.securityStatus()?.hasAuthentication}>
- <div class="bg-page rounded-md p-4 border border-border">
- <div class="space-y-3">
- <label class="flex items-start gap-3 cursor-pointer">
- <input
- type="radio"
- disabled={props.isTransferring()}
- checked={!props.useCustomPassphrase()}
- onChange={() => {
- props.setUseCustomPassphrase(false);
- props.setExportPassphrase('');
- }}
- class="mt-1 text-blue-600 focus:ring-blue-500"
- />
- <div class="flex-1">
- <div class="text-sm font-medium text-base-content">
- Use your login password
- </div>
- <div class="text-xs text-muted mt-0.5">
- Use the same password you use to log into Pulse (recommended)
- </div>
- </div>
- </label>
-
- <label class="flex items-start gap-3 cursor-pointer">
- <input
- type="radio"
- disabled={props.isTransferring()}
- checked={props.useCustomPassphrase()}
- onChange={() => props.setUseCustomPassphrase(true)}
- class="mt-1 text-blue-600 focus:ring-blue-500"
- />
- <div class="flex-1">
- <div class="text-sm font-medium text-base-content">
- Use a custom passphrase
- </div>
- <div class="text-xs text-muted mt-0.5">
- Create a different passphrase for this backup
- </div>
- </div>
- </label>
- </div>
- </div>
- </Show>
-
<div class={formField}>
<label for="backup-export-passphrase" class={labelClass()}>
- {props.securityStatus()?.hasAuthentication
- ? props.useCustomPassphrase()
- ? 'Custom Passphrase'
- : 'Enter Your Login Password'
- : 'Encryption Passphrase'}
+ Backup passphrase
</label>
<input
id="backup-export-passphrase"
disabled={props.isTransferring()}
type="password"
+ autocomplete="new-password"
+ aria-describedby="backup-export-passphrase-help"
value={props.exportPassphrase()}
onInput={(event) => props.setExportPassphrase(event.currentTarget.value)}
- placeholder={
- props.securityStatus()?.hasAuthentication
- ? props.useCustomPassphrase()
- ? 'Enter a strong passphrase'
- : 'Enter your Pulse login password'
- : 'Enter a strong passphrase for encryption'
+ placeholder="Choose a strong, unique passphrase"
+ class={controlClass()}
+ />
+ <p id="backup-export-passphrase-help" class={`${formHelpText} mt-1`}>
+ Use at least 12 characters, different from your Pulse or SSO login password. This
+ encrypts the backup; it does not verify your login. Store it separately from the
+ file. Pulse cannot recover a forgotten passphrase.
+ </p>
+ </div>
+
+ <div class={formField}>
+ <label for="backup-export-passphrase-confirmation" class={labelClass()}>
+ Confirm backup passphrase
+ </label>
+ <input
+ id="backup-export-passphrase-confirmation"
+ disabled={props.isTransferring()}
+ type="password"
+ autocomplete="new-password"
+ aria-describedby="backup-export-confirmation-help"
+ value={props.exportPassphraseConfirmation()}
+ onInput={(event) =>
+ props.setExportPassphraseConfirmation(event.currentTarget.value)
}
+ placeholder="Re-enter the backup passphrase"
class={controlClass()}
/>
- <Show
- when={!props.securityStatus()?.hasAuthentication || props.useCustomPassphrase()}
- >
- <p class={`${formHelpText} mt-1`}>
- You'll need this passphrase to restore the backup.
- </p>
- </Show>
- <Show
- when={props.securityStatus()?.hasAuthentication && !props.useCustomPassphrase()}
- >
- <p class={`${formHelpText} mt-1`}>
- You'll use this same password when restoring the backup
- </p>
- </Show>
+ <p id="backup-export-confirmation-help" class={`${formHelpText} mt-1`}>
+ Enter it again to catch typing mistakes before creating the file.
+ </p>
</div>
<div class="bg-amber-50 dark:bg-amber-900/25 border border-amber-200 dark:border-amber-800 rounded-md p-3">
@@ -178,11 +136,7 @@ export const BackupTransferDialogs: Component<BackupTransferDialogsProps> = (pro
>
migration guide
</ExternalTextLink>{' '}
- before relying on this for recovery. Remember your{' '}
- {props.useCustomPassphrase() || !props.securityStatus()?.hasAuthentication
- ? 'passphrase'
- : 'password'}{' '}
- for restoring.
+ before relying on this for recovery. Keep your backup passphrase for restoring.
</div>
</div>
</div>
@@ -201,8 +155,8 @@ export const BackupTransferDialogs: Component<BackupTransferDialogsProps> = (pro
onClick={props.handleExport}
disabled={
props.isTransferring() ||
- !props.exportPassphrase() ||
- (props.useCustomPassphrase() && props.exportPassphrase().length < 12)
+ props.exportPassphrase().length < 12 ||
+ !props.exportPassphraseConfirmation()
}
class="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed"
>
@@ -332,19 +286,22 @@ export const BackupTransferDialogs: Component<BackupTransferDialogsProps> = (pro
<div class={formField}>
<label for="backup-import-passphrase" class={labelClass()}>
- Backup Password
+ Backup passphrase
</label>
<input
id="backup-import-passphrase"
disabled={props.isTransferring()}
type="password"
+ autocomplete="off"
+ aria-describedby="backup-import-passphrase-help"
value={props.importPassphrase()}
onInput={(event) => props.setImportPassphrase(event.currentTarget.value)}
- placeholder="Enter the password used when creating this backup"
+ placeholder="Enter the passphrase used when creating this backup"
class={controlClass()}
/>
- <p class={`${formHelpText} mt-1`}>
- This is usually your Pulse login password, unless you used a custom passphrase
+ <p id="backup-import-passphrase-help" class={`${formHelpText} mt-1`}>
+ Use the original passphrase for this file. For older backups, this may be the
+ login password you chose when exporting, not your current login password.
</p>
</div>
diff --git a/frontend-modern/src/components/Settings/RecoverySettingsPanel.tsx b/frontend-modern/src/components/Settings/RecoverySettingsPanel.tsx
index 5421f7d345..1a6fcd319c 100644
--- a/frontend-modern/src/components/Settings/RecoverySettingsPanel.tsx
+++ b/frontend-modern/src/components/Settings/RecoverySettingsPanel.tsx
@@ -28,8 +28,6 @@ export interface RecoverySettingsPanelProps {
setShowExportDialog: (open: boolean) => void;
showImportDialog: Accessor<boolean>;
setShowImportDialog: (open: boolean) => void;
- setUseCustomPassphrase: Setter<boolean>;
- securityStatus: Accessor<{ hasAuthentication: boolean } | null>;
}
export const RecoverySettingsPanel: Component<RecoverySettingsPanelProps> = (props) => {
@@ -297,11 +295,7 @@ export const RecoverySettingsPanel: Component<RecoverySettingsPanelProps> = (pro
<button
type="button"
- onClick={() => {
- // Default to custom passphrase if no auth is configured
- props.setUseCustomPassphrase(!props.securityStatus()?.hasAuthentication);
- props.setShowExportDialog(true);
- }}
+ onClick={() => props.setShowExportDialog(true)}
class="w-full sm:w-auto min-h-10 sm:min-h-9 px-4 py-2.5 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 transition-all duration-200 inline-flex items-center justify-center gap-2 shadow-xs hover:shadow-xs"
>
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
diff --git a/frontend-modern/src/components/Settings/Settings.tsx b/frontend-modern/src/components/Settings/Settings.tsx
index 2425bb4405..9b4f4ff688 100644
--- a/frontend-modern/src/components/Settings/Settings.tsx
+++ b/frontend-modern/src/components/Settings/Settings.tsx
@@ -121,7 +121,6 @@ const SettingsWorkspace: Component<SettingsProps> = (props) => {
initialLoadComplete: infrastructureSettings.initialLoadComplete,
systemSettings,
backupTransferFlow,
- securityStatus,
});
const infrastructurePanelProps = useSettingsInfrastructurePanelProps({
selectedAgent,
@@ -216,11 +215,10 @@ const SettingsWorkspace: Component<SettingsProps> = (props) => {
updateInfo={systemSettings.updateInfo}
updatePlan={systemSettings.updatePlan}
isInstallingUpdate={systemSettings.isInstallingUpdate}
- securityStatus={securityStatus}
exportPassphrase={backupTransferFlow.exportPassphrase}
setExportPassphrase={backupTransferFlow.setExportPassphrase}
- useCustomPassphrase={backupTransferFlow.useCustomPassphrase}
- setUseCustomPassphrase={backupTransferFlow.setUseCustomPassphrase}
+ exportPassphraseConfirmation={backupTransferFlow.exportPassphraseConfirmation}
+ setExportPassphraseConfirmation={backupTransferFlow.setExportPassphraseConfirmation}
importPassphrase={backupTransferFlow.importPassphrase}
setImportPassphrase={backupTransferFlow.setImportPassphrase}
importFile={backupTransferFlow.importFile}
diff --git a/frontend-modern/src/components/Settings/SettingsDialogs.tsx b/frontend-modern/src/components/Settings/SettingsDialogs.tsx
index 71c6b97dab..d90754eda2 100644
--- a/frontend-modern/src/components/Settings/SettingsDialogs.tsx
+++ b/frontend-modern/src/components/Settings/SettingsDialogs.tsx
@@ -1,6 +1,5 @@
import { Accessor, Component } from 'solid-js';
import type { UpdateInfo, UpdatePlan, VersionInfo } from '@/api/updates';
-import type { SecurityStatus as SecurityStatusInfo } from '@/types/config';
import { UpdateConfirmationModal } from '@/components/UpdateConfirmationModal';
import { BackupTransferDialogs } from './BackupTransferDialogs';
import { ChangePasswordModal } from './ChangePasswordModal';
@@ -13,11 +12,10 @@ interface SettingsDialogsProps {
updateInfo: Accessor<UpdateInfo | null>;
updatePlan: Accessor<UpdatePlan | null>;
isInstallingUpdate: Accessor<boolean>;
- securityStatus: Accessor<SecurityStatusInfo | null>;
exportPassphrase: Accessor<string>;
setExportPassphrase: (value: string) => void;
- useCustomPassphrase: Accessor<boolean>;
- setUseCustomPassphrase: (value: boolean) => void;
+ exportPassphraseConfirmation: Accessor<string>;
+ setExportPassphraseConfirmation: (value: string) => void;
importPassphrase: Accessor<string>;
setImportPassphrase: (value: string) => void;
importFile: Accessor<File | null>;
@@ -65,11 +63,10 @@ export const SettingsDialogs: Component<SettingsDialogsProps> = (props) => {
/>
<BackupTransferDialogs
- securityStatus={props.securityStatus}
exportPassphrase={props.exportPassphrase}
setExportPassphrase={props.setExportPassphrase}
- useCustomPassphrase={props.useCustomPassphrase}
- setUseCustomPassphrase={props.setUseCustomPassphrase}
+ exportPassphraseConfirmation={props.exportPassphraseConfirmation}
+ setExportPassphraseConfirmation={props.setExportPassphraseConfirmation}
importPassphrase={props.importPassphrase}
setImportPassphrase={props.setImportPassphrase}
importFile={props.importFile}
diff --git a/frontend-modern/src/components/Settings/__tests__/BackupTransferDialogs.test.tsx b/frontend-modern/src/components/Settings/__tests__/BackupTransferDialogs.test.tsx
index bea4655fa2..b773606aeb 100644
--- a/frontend-modern/src/components/Settings/__tests__/BackupTransferDialogs.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/BackupTransferDialogs.test.tsx
@@ -14,11 +14,10 @@ function renderTransfer(
) {
return render(() => (
<BackupTransferDialogs
- securityStatus={() => null}
exportPassphrase={() => ''}
setExportPassphrase={vi.fn()}
- useCustomPassphrase={() => false}
- setUseCustomPassphrase={vi.fn()}
+ exportPassphraseConfirmation={() => ''}
+ setExportPassphraseConfirmation={vi.fn()}
importPassphrase={() => 'secure-passphrase'}
setImportPassphrase={vi.fn()}
importFile={() => null}
@@ -117,9 +116,17 @@ describe('BackupTransferDialogs', () => {
expect(text).toContain('Review the workspace and submit again yourself.');
});
- function renderFlow(kind: 'export' | 'import' = 'import', tokenOnly = false) {
+ function renderFlow(
+ kind: 'export' | 'import' = 'import',
+ tokenOnly = false,
+ security: Partial<SecurityStatus> = {},
+ ) {
const securityStatus = () =>
- ({ hasAuthentication: !tokenOnly, apiTokenConfigured: tokenOnly }) as SecurityStatus;
+ ({
+ hasAuthentication: !tokenOnly,
+ apiTokenConfigured: tokenOnly,
+ ...security,
+ }) as SecurityStatus;
let flow!: ReturnType<typeof useBackupTransferFlow>;
setOrgID('tenant-fixture');
document.cookie = 'pulse_csrf=synthetic-csrf; Path=/';
@@ -134,7 +141,7 @@ describe('BackupTransferDialogs', () => {
>
Open transfer
</button>
- <BackupTransferDialogs {...flow} securityStatus={securityStatus} />
+ <BackupTransferDialogs {...flow} />
<ToastContainer />
</>
);
@@ -143,10 +150,79 @@ describe('BackupTransferDialogs', () => {
if (kind === 'import') {
flow.setImportPassphrase('synthetic-passphrase');
flow.setImportFile({ text: async () => '{"data":"synthetic-archive"}' } as File);
- } else flow.setExportPassphrase('synthetic-passphrase');
+ } else {
+ flow.setExportPassphrase('synthetic-passphrase');
+ flow.setExportPassphraseConfirmation('synthetic-passphrase');
+ }
return flow;
}
+ it.each([
+ { hasAuthentication: true, ssoEnabled: true },
+ { hasAuthentication: true, ssoEnabled: false },
+ { hasAuthentication: false },
+ ])('offers the same separate, masked backup passphrase for %j', (security) => {
+ renderFlow('export', false, security);
+ const dialog = screen.getByRole('dialog', { name: 'Export configuration' });
+ expect(within(dialog).queryByRole('radio')).not.toBeInTheDocument();
+ expect(within(dialog).getByLabelText('Backup passphrase')).toHaveAttribute('type', 'password');
+ expect(within(dialog).getByLabelText('Backup passphrase')).toHaveAttribute(
+ 'autocomplete',
+ 'new-password',
+ );
+ expect(within(dialog).getByLabelText('Backup passphrase')).toHaveAccessibleDescription(
+ /different from your Pulse or SSO login password.*does not verify your login/s,
+ );
+ expect(within(dialog).getByLabelText('Confirm backup passphrase')).toHaveAttribute(
+ 'type',
+ 'password',
+ );
+ expect(within(dialog).getByLabelText('Confirm backup passphrase')).toHaveAccessibleDescription(
+ 'Enter it again to catch typing mistakes before creating the file.',
+ );
+ expect(dialog).not.toHaveTextContent('Use your login password');
+ });
+
+ it('keeps an export typo unsent and lets the operator correct it explicitly', async () => {
+ const fetchMock = vi
+ .fn()
+ .mockImplementation(async () => new Response('synthetic refusal', { status: 403 }));
+ vi.stubGlobal('fetch', fetchMock);
+ const flow = renderFlow('export');
+ const dialog = screen.getByRole('dialog');
+ const confirm = within(dialog).getByLabelText('Confirm backup passphrase');
+ fireEvent.input(confirm, { target: { value: '' } });
+ expect(within(dialog).getByRole('button', { name: 'Export' })).toBeDisabled();
+ fireEvent.input(confirm, { target: { value: 'synthetic-passphrase-typo' } });
+ fireEvent.click(within(dialog).getByRole('button', { name: 'Export' }));
+ expect(within(dialog).getByRole('alert')).toHaveTextContent(
+ 'Passphrases do not match. No export was sent.',
+ );
+ expect(fetchMock).not.toHaveBeenCalled();
+ fireEvent.input(confirm, { target: { value: 'synthetic-passphrase' } });
+ fireEvent.click(within(dialog).getByRole('button', { name: 'Export' }));
+ await waitFor(() => expect(flow.isTransferring()).toBe(false));
+ expect(fetchMock).toHaveBeenCalledTimes(1);
+ expect(JSON.parse(fetchMock.mock.calls[0][1].body)).toEqual({
+ passphrase: 'synthetic-passphrase',
+ });
+ expect(within(dialog).getByRole('alert')).toHaveTextContent('synthetic refusal');
+ expect(flow.exportPassphraseConfirmation()).toBe('synthetic-passphrase');
+ fireEvent.click(within(dialog).getByRole('button', { name: 'Cancel' }));
+ expect(flow.exportPassphraseConfirmation()).toBe('');
+ expect(flow.exportPassphrase()).toBe('');
+ fireEvent.click(screen.getByRole('button', { name: 'Open transfer' }));
+ expect(screen.getByLabelText('Confirm backup passphrase')).toHaveValue('');
+ });
+
+ it('asks for the original archive passphrase, including older password-based exports', () => {
+ renderTransfer('import');
+ expect(screen.getByLabelText('Backup passphrase')).toHaveAccessibleDescription(
+ 'Use the original passphrase for this file. For older backups, this may be the login password you chose when exporting, not your current login password.',
+ );
+ expect(screen.queryByLabelText('Confirm backup passphrase')).not.toBeInTheDocument();
+ });
+
it.each(['export', 'import'] as const)(
'keeps repeated %s failures in one persistent dialog alert without toast stacking',
async (kind) => {
diff --git a/frontend-modern/src/components/Settings/__tests__/RecoverySettingsPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/RecoverySettingsPanel.test.tsx
index f17455d8a5..14ec3d9ddc 100644
--- a/frontend-modern/src/components/Settings/__tests__/RecoverySettingsPanel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/RecoverySettingsPanel.test.tsx
@@ -3,7 +3,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest';
import { createSignal } from 'solid-js';
import { RecoverySettingsPanel } from '../RecoverySettingsPanel';
-function renderRecovery(hasAuthentication = false) {
+function renderRecovery() {
const [enabled, setEnabled] = createSignal(true);
const [interval, setInterval] = createSignal(300);
const [minutes, setMinutes] = createSignal(5);
@@ -11,7 +11,6 @@ function renderRecovery(hasAuthentication = false) {
const [, setUnsaved] = createSignal(false);
const setShowExportDialog = vi.fn();
const setShowImportDialog = vi.fn();
- const setUseCustomPassphrase = vi.fn();
render(() => (
<RecoverySettingsPanel
backupPollingEnabled={enabled}
@@ -30,11 +29,9 @@ function renderRecovery(hasAuthentication = false) {
setShowExportDialog={setShowExportDialog}
showImportDialog={() => false}
setShowImportDialog={setShowImportDialog}
- setUseCustomPassphrase={setUseCustomPassphrase}
- securityStatus={() => ({ hasAuthentication })}
/>
));
- return { setShowExportDialog, setShowImportDialog, setUseCustomPassphrase };
+ return { setShowExportDialog, setShowImportDialog };
}
describe('RecoverySettingsPanel', () => {
@@ -57,7 +54,7 @@ describe('RecoverySettingsPanel', () => {
});
it('warns that restoring replaces included settings rather than offering a merge', () => {
- renderRecovery(true);
+ renderRecovery();
const text = document.body.textContent;
expect(text).toContain('Back up the destination first');
expect(text).toContain('Replaces included settings and API-token records');
@@ -65,22 +62,17 @@ describe('RecoverySettingsPanel', () => {
expect(screen.getByRole('button', { name: 'Restore Backup' })).toBeEnabled();
});
- it.each([false, true])(
- 'opens export with the existing passphrase default (authentication: %s)',
- (hasAuthentication) => {
- const actions = renderRecovery(hasAuthentication);
- fireEvent.click(screen.getByRole('button', { name: 'Create Backup' }));
- expect(actions.setUseCustomPassphrase).toHaveBeenCalledExactlyOnceWith(!hasAuthentication);
- expect(actions.setShowExportDialog).toHaveBeenCalledExactlyOnceWith(true);
- expect(actions.setShowImportDialog).not.toHaveBeenCalled();
- },
- );
+ it('opens only the export dialog without selecting a login-credential mode', () => {
+ const actions = renderRecovery();
+ fireEvent.click(screen.getByRole('button', { name: 'Create Backup' }));
+ expect(actions.setShowExportDialog).toHaveBeenCalledExactlyOnceWith(true);
+ expect(actions.setShowImportDialog).not.toHaveBeenCalled();
+ });
it('opens only the existing import dialog from Restore Backup', () => {
const actions = renderRecovery();
fireEvent.click(screen.getByRole('button', { name: 'Restore Backup' }));
expect(actions.setShowImportDialog).toHaveBeenCalledExactlyOnceWith(true);
expect(actions.setShowExportDialog).not.toHaveBeenCalled();
- expect(actions.setUseCustomPassphrase).not.toHaveBeenCalled();
});
});
diff --git a/frontend-modern/src/components/Settings/__tests__/SettingsSwitchLabels.test.tsx b/frontend-modern/src/components/Settings/__tests__/SettingsSwitchLabels.test.tsx
index 6c4f3df33b..b395fa94ed 100644
--- a/frontend-modern/src/components/Settings/__tests__/SettingsSwitchLabels.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/SettingsSwitchLabels.test.tsx
@@ -74,7 +74,6 @@ describe('settings switch labels', () => {
const [backupPollingUseCustom, setBackupPollingUseCustom] = createSignal(false);
const [showExportDialog, setShowExportDialog] = createSignal(false);
const [showImportDialog, setShowImportDialog] = createSignal(false);
- const [useCustomPassphrase, setUseCustomPassphrase] = createSignal(false);
render(() => (
<RecoverySettingsPanel
@@ -94,12 +93,9 @@ describe('settings switch labels', () => {
setShowExportDialog={setShowExportDialog}
showImportDialog={showImportDialog}
setShowImportDialog={setShowImportDialog}
- setUseCustomPassphrase={setUseCustomPassphrase}
- securityStatus={() => ({ hasAuthentication: true })}
/>
));
expect(screen.getByRole('checkbox', { name: 'Enable backup polling' })).toBeChecked();
- expect(useCustomPassphrase()).toBe(false);
});
});
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
index 5016bd9d66..0e4be08de2 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
@@ -116,6 +116,16 @@ const settingsRuntimeSources = import.meta.glob(['../*.tsx', '../ConnectionEdito
}) as Record<string, string>;
describe('settings architecture guardrails', () => {
+ it('forwards both export passphrase inputs without a login-password mode', () => {
+ for (const source of [settingsSource, settingsDialogsSource]) {
+ expect(source).toMatch(/exportPassphraseConfirmation=\{/);
+ expect(source).toMatch(/setExportPassphraseConfirmation=\{/);
+ expect(source).not.toContain('useCustomPassphrase');
+ }
+ expect(recoverySettingsPanelSource).not.toContain('securityStatus');
+ expect(recoverySettingsPanelSource).not.toContain('setUseCustomPassphrase');
+ });
+
it('carries transfer target, pending and dialog-owned feedback through the Settings shell', () => {
for (const name of [
'transferOrgID',
diff --git a/frontend-modern/src/components/Settings/__tests__/useBackupTransferFlow.test.ts b/frontend-modern/src/components/Settings/__tests__/useBackupTransferFlow.test.ts
index 56bb62d8e5..bde6046311 100644
--- a/frontend-modern/src/components/Settings/__tests__/useBackupTransferFlow.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/useBackupTransferFlow.test.ts
@@ -46,6 +46,7 @@ function setup(kind: 'export' | 'import' = 'import', tokenOnly = false) {
else flow.setShowExportDialog(true);
flow.setImportPassphrase(passphrase);
flow.setExportPassphrase(passphrase);
+ flow.setExportPassphraseConfirmation(passphrase);
const read = vi.fn().mockResolvedValue('{"data":"synthetic-archive"}');
flow.setImportFile({ size: 28, text: read } as unknown as File);
return { flow, read, dispose };
@@ -90,6 +91,76 @@ afterEach(() => {
});
describe('configuration transfers keep their confirmed workspace and one dispatch', () => {
+ it.each([
+ ['', passphrase, 'Please enter a backup passphrase'],
+ ['short', 'short', 'at least 12 characters'],
+ [passphrase, '', 'Please confirm the backup passphrase'],
+ [passphrase, `${passphrase}-typo`, 'Passphrases do not match'],
+ ])('rejects an unconfirmed export before asking for a token', async (value, confirm, message) => {
+ const { flow } = setup('export', true);
+ flow.setExportPassphrase(value);
+ flow.setExportPassphraseConfirmation(confirm);
+ await flow.handleExport();
+ expect(flow.transferError()).toContain(message);
+ expect(flow.showApiTokenModal()).toBe(false);
+ expect(flow.isTransferring()).toBe(false);
+ expect(flow.showExportDialog()).toBe(true);
+ expect(flow.exportPassphrase()).toBe(value);
+ expect(flow.exportPassphraseConfirmation()).toBe(confirm);
+ expect(fetchMock).not.toHaveBeenCalled();
+ expect(URL.createObjectURL).not.toHaveBeenCalled();
+ expect(notificationStore.success).not.toHaveBeenCalled();
+ });
+
+ it('requires exact confirmation, without trimming or changing the encryption passphrase', async () => {
+ const { flow } = setup('export');
+ const value = ` ${passphrase} `;
+ flow.setExportPassphrase(value);
+ await flow.handleExport();
+ expect(flow.transferError()).toContain('Passphrases do not match');
+ expect(fetchMock).not.toHaveBeenCalled();
+ flow.setExportPassphraseConfirmation(value);
+ await flow.handleExport();
+ expect(fetchMock).toHaveBeenCalledTimes(1);
+ expect(JSON.parse(fetchMock.mock.calls[0][1].body)).toEqual({ passphrase: value });
+ expect(flow.transferError()).toBe('');
+ expect(flow.exportPassphraseConfirmation()).toBe('');
+ });
+
+ it('clears both export secrets on close and when switching to import', () => {
+ const { flow } = setup('export');
+ flow.closeExportDialog();
+ expect(flow.exportPassphrase()).toBe('');
+ expect(flow.exportPassphraseConfirmation()).toBe('');
+ flow.setShowExportDialog(true);
+ flow.setExportPassphrase(passphrase);
+ flow.setExportPassphraseConfirmation(passphrase);
+ flow.setShowImportDialog(true);
+ expect(flow.exportPassphrase()).toBe('');
+ expect(flow.exportPassphraseConfirmation()).toBe('');
+ expect(flow.showExportDialog()).toBe(false);
+ expect(flow.showImportDialog()).toBe(true);
+ expect(fetchMock).not.toHaveBeenCalled();
+ });
+
+ it('freezes the confirmed export passphrase and never dispatches its confirmation', async () => {
+ const { flow } = setup('export');
+ const result = deferred<Response>();
+ fetchMock.mockReturnValue(result.promise);
+ const pending = flow.handleExport();
+ flow.setExportPassphrase('edited-after-submit');
+ flow.setExportPassphraseConfirmation('edited-confirmation');
+ await flow.handleExport();
+ flow.closeExportDialog();
+ expect(flow.showExportDialog()).toBe(true);
+ expect(fetchMock).toHaveBeenCalledTimes(1);
+ expect(JSON.parse(fetchMock.mock.calls[0][1].body)).toEqual({ passphrase });
+ result.resolve(response());
+ await pending;
+ expect(flow.exportPassphrase()).toBe('');
+ expect(flow.exportPassphraseConfirmation()).toBe('');
+ });
+
it('rejects an oversized file before reading it or asking for a token', async () => {
const { flow, read } = setup('import', true);
flow.setImportFile({ size: MAX_CONFIG_IMPORT_FILE_BYTES + 1, text: read } as unknown as File);
@@ -404,6 +475,7 @@ describe('configuration transfers keep their confirmed workspace and one dispatc
expect(HTMLAnchorElement.prototype.click).toHaveBeenCalledTimes(1);
expect(URL.revokeObjectURL).toHaveBeenCalledWith('blob:synthetic');
expect(flow.exportPassphrase()).toBe('');
+ expect(flow.exportPassphraseConfirmation()).toBe('');
expect(flow.showExportDialog()).toBe(false);
});
diff --git a/frontend-modern/src/components/Settings/useBackupTransferFlow.ts b/frontend-modern/src/components/Settings/useBackupTransferFlow.ts
index c734f35e13..96d12eb886 100644
--- a/frontend-modern/src/components/Settings/useBackupTransferFlow.ts
+++ b/frontend-modern/src/components/Settings/useBackupTransferFlow.ts
@@ -23,7 +23,7 @@ export const MAX_CONFIG_IMPORT_REQUEST_BYTES = 1024 * 1024;
export function useBackupTransferFlow({ securityStatus }: UseBackupTransferFlowParams) {
const [exportPassphrase, setExportPassphrase] = createSignal('');
- const [useCustomPassphrase, setUseCustomPassphrase] = createSignal(false);
+ const [exportPassphraseConfirmation, setExportPassphraseConfirmation] = createSignal('');
const [importPassphrase, setImportPassphrase] = createSignal('');
const [importFile, setImportFile] = createSignal<File | null>(null);
const [showExportDialog, showExport] = createSignal(false);
@@ -65,7 +65,7 @@ export function useBackupTransferFlow({ securityStatus }: UseBackupTransferFlowP
if (isTransferring()) return;
showExport(false);
setExportPassphrase('');
- setUseCustomPassphrase(false);
+ setExportPassphraseConfirmation('');
closeApiTokenModal();
};
const closeImportDialog = () => {
@@ -109,19 +109,19 @@ export function useBackupTransferFlow({ securityStatus }: UseBackupTransferFlowP
setTransferNotice('');
const passphrase = exportPassphrase();
if (!passphrase) {
- fail(
- securityStatus()?.hasAuthentication && !useCustomPassphrase()
- ? 'Please enter your password'
- : 'Please enter a passphrase',
- );
+ fail('Please enter a backup passphrase');
return;
}
if (passphrase.length < 12) {
- fail(
- securityStatus()?.hasAuthentication && !useCustomPassphrase()
- ? 'Your password must be at least 12 characters. Please use a custom passphrase instead.'
- : 'Passphrase must be at least 12 characters long',
- );
+ fail('Passphrase must be at least 12 characters long');
+ return;
+ }
+ if (!exportPassphraseConfirmation()) {
+ fail('Please confirm the backup passphrase. No export was sent.');
+ return;
+ }
+ if (passphrase !== exportPassphraseConfirmation()) {
+ fail('Passphrases do not match. No export was sent.');
return;
}
if (needsApiToken()) return;
@@ -154,7 +154,7 @@ export function useBackupTransferFlow({ securityStatus }: UseBackupTransferFlowP
notificationStore.success('Configuration exported successfully');
showExport(false);
setExportPassphrase('');
- setUseCustomPassphrase(false);
+ setExportPassphraseConfirmation('');
} catch (error) {
if (active) fail(error instanceof Error ? error.message : 'Failed to export configuration');
} finally {
@@ -169,7 +169,7 @@ export function useBackupTransferFlow({ securityStatus }: UseBackupTransferFlowP
const passphrase = importPassphrase();
const file = importFile();
if (!passphrase) {
- fail('Please enter the password');
+ fail('Please enter the backup passphrase');
return;
}
if (!file) {
@@ -283,8 +283,8 @@ export function useBackupTransferFlow({ securityStatus }: UseBackupTransferFlowP
return {
exportPassphrase,
setExportPassphrase,
- useCustomPassphrase,
- setUseCustomPassphrase,
+ exportPassphraseConfirmation,
+ setExportPassphraseConfirmation,
importPassphrase,
setImportPassphrase,
importFile,
diff --git a/frontend-modern/src/components/Settings/useSettingsSystemPanels.tsx b/frontend-modern/src/components/Settings/useSettingsSystemPanels.tsx
index b27eb1ca9f..91a55d9daa 100644
--- a/frontend-modern/src/components/Settings/useSettingsSystemPanels.tsx
+++ b/frontend-modern/src/components/Settings/useSettingsSystemPanels.tsx
@@ -1,5 +1,4 @@
import { Accessor, Component, Show } from 'solid-js';
-import type { SecurityStatus as SecurityStatusInfo } from '@/types/config';
import { GeneralSettingsPanel, type GeneralSettingsPanelProps } from './GeneralSettingsPanel';
import type { NetworkSettingsPanelProps } from './networkSettingsModel';
import type { RecoverySettingsPanelProps } from './RecoverySettingsPanel';
@@ -15,7 +14,6 @@ interface UseSettingsSystemPanelsParams {
initialLoadComplete: Accessor<boolean>;
systemSettings: ReturnType<typeof useSystemSettingsState>;
backupTransferFlow: ReturnType<typeof useBackupTransferFlow>;
- securityStatus: Accessor<SecurityStatusInfo | null>;
}
export interface SettingsSystemPanels {
@@ -129,8 +127,6 @@ export function useSettingsSystemPanels(
setShowExportDialog: params.backupTransferFlow.setShowExportDialog,
showImportDialog: params.backupTransferFlow.showImportDialog,
setShowImportDialog: params.backupTransferFlow.setShowImportDialog,
- setUseCustomPassphrase: params.backupTransferFlow.setUseCustomPassphrase,
- securityStatus: params.securityStatus,
}),
};
}
diff --git a/frontend-modern/src/features/docs/__tests__/configurationTransferAccessDocs.test.ts b/frontend-modern/src/features/docs/__tests__/configurationTransferAccessDocs.test.ts
index dc9ed9307a..000fbc94bf 100644
--- a/frontend-modern/src/features/docs/__tests__/configurationTransferAccessDocs.test.ts
+++ b/frontend-modern/src/features/docs/__tests__/configurationTransferAccessDocs.test.ts
@@ -32,6 +32,25 @@ function accessSection() {
const textOf = (node: Element) => node.textContent!.replace(/\s+/g, ' ');
describe('Configuration transfer access guidance', () => {
+ it('uses a confirmed recovery-only passphrase without invalidating older archives', () => {
+ const article = articleFor('MIGRATION');
+ const heading = article.querySelector('#transfer-the-included-configuration');
+ expect(heading).not.toBeNull();
+ const steps = heading!.nextElementSibling;
+ expect(steps?.tagName).toBe('OL');
+ const text = textOf(steps!);
+ expect(text).toContain('strong, unique passphrase of at least 12 characters');
+ expect(text).toContain('Confirm backup passphrase');
+ expect(text).toContain('different passphrase from your Pulse or SSO login password');
+ expect(text).toContain('not a sign-in check');
+ expect(text).toContain('Pulse cannot recover a forgotten passphrase');
+ expect(text).toContain('Restore Backup');
+ expect(text).toContain(
+ 'Older backups still accept the password or passphrase you chose when exporting',
+ );
+ expect(text).not.toContain('Use a custom passphrase');
+ });
+
it('places target checks before transfer and links them from the first step', () => {
const article = articleFor('MIGRATION');
const headings = [...article.querySelectorAll('h2')].map((heading) => heading.id);