mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-09-21 12:10:13 +00:00
fix: address security issue
This commit is contained in:
@@ -5,7 +5,8 @@ import type { Profile, SessionState } from './types';
|
||||
|
||||
export async function silentlyRepairBackupSettingsIfNeeded(
|
||||
activeSession: SessionState,
|
||||
activeProfile: Profile
|
||||
activeProfile: Profile,
|
||||
verification?: { masterPasswordHash?: string | null; userVerificationToken?: string | null } | null
|
||||
): Promise<void> {
|
||||
if (activeProfile.role !== 'admin') return;
|
||||
if (!activeSession.accessToken || !activeSession.symEncKey || !activeSession.symMacKey) return;
|
||||
@@ -14,8 +15,9 @@ export async function silentlyRepairBackupSettingsIfNeeded(
|
||||
try {
|
||||
const state = await getAdminBackupSettingsRepairState(tempFetch);
|
||||
if (!state.needsRepair || !state.portable) return;
|
||||
if (!verification?.masterPasswordHash && !verification?.userVerificationToken) return;
|
||||
const repairedSettings = await decryptPortableBackupSettings(state.portable, activeProfile, activeSession);
|
||||
await repairAdminBackupSettings(tempFetch, repairedSettings);
|
||||
await repairAdminBackupSettings(tempFetch, verification, repairedSettings);
|
||||
} catch (error) {
|
||||
console.error('Backup settings auto-repair failed:', error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user