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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Stop persisting the plaintext admin password in setup handoff
rcourtmanae8c2558cce4
diff --git a/frontend-modern/src/components/Settings/InfrastructureInstallerSection.tsx b/frontend-modern/src/components/Settings/InfrastructureInstallerSection.tsxindex c13be840ca..c73060e798 100644--- a/frontend-modern/src/components/Settings/InfrastructureInstallerSection.tsx+++ b/frontend-modern/src/components/Settings/InfrastructureInstallerSection.tsx@@ -192,21 +192,13 @@ export const InfrastructureInstallerSection: Component<InfrastructureInstallerSeunlock without another setup step.</Show></p>- <div class="grid gap-3 sm:grid-cols-3">+ <div class="grid gap-3 sm:grid-cols-2"><div class="rounded-md border border-emerald-200 bg-white px-3 py-2 dark:border-emerald-800 dark:bg-emerald-950"><div class="text-[11px] font-medium uppercase tracking-wide text-emerald-700 dark:text-emerald-300">Username</div><div class="mt-1 font-mono text-sm text-base-content">{handoff().username}</div></div>- <div class="rounded-md border border-emerald-200 bg-white px-3 py-2 dark:border-emerald-800 dark:bg-emerald-950">- <div class="text-[11px] font-medium uppercase tracking-wide text-emerald-700 dark:text-emerald-300">- Password- </div>- <div class="mt-1 break-all font-mono text-sm text-base-content">- {handoff().password}- </div>- </div><div class="rounded-md border border-emerald-200 bg-white px-3 py-2 dark:border-emerald-800 dark:bg-emerald-950"><div class="text-[11px] font-medium uppercase tracking-wide text-emerald-700 dark:text-emerald-300">Admin API Token@@ -216,20 +208,12 @@ export const InfrastructureInstallerSection: Component<InfrastructureInstallerSe</div></div></div>+ <p class="text-xs text-emerald-800 dark:text-emerald-200">+ Your admin password was shown once on the setup screen and isn't stored here. If+ you didn't save it, change it from Settings → Security → Change password.+ </p></div><div class="flex flex-wrap gap-2 lg:w-64 lg:flex-col">- <button- type="button"- onClick={() =>- void state.copySetupHandoffField(- handoff().password,- 'Copied first-run password.',- )- }- class="inline-flex items-center justify-center rounded-md border border-emerald-300 bg-white px-3 py-2 text-sm font-medium text-emerald-900 hover:bg-emerald-100 dark:border-emerald-700 dark:bg-emerald-950 dark:text-emerald-100 dark:hover:bg-emerald-800"- >- Copy password- </button><buttontype="button"onClick={() =>diff --git a/frontend-modern/src/components/Settings/infrastructureOperationsModel.tsx b/frontend-modern/src/components/Settings/infrastructureOperationsModel.tsxindex 8b0e29b7ca..192117e70d 100644--- a/frontend-modern/src/components/Settings/infrastructureOperationsModel.tsx+++ b/frontend-modern/src/components/Settings/infrastructureOperationsModel.tsx@@ -15,7 +15,6 @@ export type InstallProfile = 'auto' | 'docker' | 'kubernetes' | 'proxmox-pve' |export type SetupHandoffState = {username: string;- password: string;apiToken: string;createdAt?: string;};diff --git a/frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx b/frontend-modern/src/components/Settings/useInfrastructureInstallState.tsxindex d74b55fadc..cb6f6f6ef5 100644--- a/frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx+++ b/frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx@@ -135,10 +135,9 @@ export const useInfrastructureInstallState = (if (rawSetupHandoff) {try {const parsed = JSON.parse(rawSetupHandoff) as Partial<SetupHandoffState>;- if (parsed.username && parsed.password && parsed.apiToken) {+ if (parsed.username && parsed.apiToken) {setSetupHandoff({username: parsed.username,- password: parsed.password,apiToken: parsed.apiToken,createdAt: parsed.createdAt,});@@ -204,7 +203,7 @@ Web Login:----------URL: ${baseUrl}Username: ${handoff.username}-Password: ${handoff.password}+Password: shown once on the setup completion screen and not stored here. If you didn't save it, change it from Settings → Security → Change password.Admin API Token:----------------diff --git a/frontend-modern/src/components/SetupWizard/__tests__/SecurityStep.test.tsx b/frontend-modern/src/components/SetupWizard/__tests__/SecurityStep.test.tsxindex 2d3f723616..b13c488151 100644--- a/frontend-modern/src/components/SetupWizard/__tests__/SecurityStep.test.tsx+++ b/frontend-modern/src/components/SetupWizard/__tests__/SecurityStep.test.tsx@@ -52,7 +52,7 @@ describe('SecurityStep', () => {vi.unstubAllGlobals();});- it('generates and persists first-run credentials before entering the completion handoff', async () => {+ it('hands off username and token but never persists the plaintext password', async () => {const updateState = vi.fn();const onComplete = vi.fn();@@ -88,6 +88,8 @@ describe('SecurityStep', () => {expect(body.apiToken).toHaveLength(48);expect(body.setupToken).toBe('bootstrap-token');expect(setApiTokenMock).toHaveBeenCalledWith(body.apiToken);+ // The password is kept in in-memory wizard state so the completion screen+ // can show it once for the user to save.expect(updateState).toHaveBeenCalledWith({username: 'admin',password: body.password,@@ -104,9 +106,12 @@ describe('SecurityStep', () => {};expect(storedHandoff).toMatchObject({username: 'admin',- password: body.password,apiToken: body.apiToken,});+ // The plaintext admin password must never be written to browser storage+ // (code-scanning finding). It lives only in in-memory wizard state and is+ // shown once on the completion screen.+ expect(storedHandoff.password).toBeUndefined();expect(storedHandoff.createdAt).toEqual(expect.any(String));expect(onComplete).toHaveBeenCalledOnce();expect(showErrorMock).not.toHaveBeenCalled();diff --git a/frontend-modern/src/components/SetupWizard/steps/SecurityStep.tsx b/frontend-modern/src/components/SetupWizard/steps/SecurityStep.tsxindex c1fe299c03..cf64bf12ae 100644--- a/frontend-modern/src/components/SetupWizard/steps/SecurityStep.tsx+++ b/frontend-modern/src/components/SetupWizard/steps/SecurityStep.tsx@@ -92,11 +92,15 @@ export const SecurityStep: Component<SecurityStepProps> = (props) => {if (typeof window !== 'undefined') {try {+ // Persist only the username and admin API token for the+ // infrastructure-onboarding handoff. The plaintext admin password is+ // deliberately NOT written to browser storage (code-scanning finding):+ // it is shown once on the completion screen from in-memory wizard+ // state, which is where the user is told to save it.sessionStorage.setItem(STORAGE_KEYS.SETUP_HANDOFF,JSON.stringify({username: username(),- password: finalPassword,apiToken: token,createdAt: new Date().toISOString(),}),