Fix: Password Change/Reset Credential Preservation #383

Merged
thorved merged 3 commits from fix/password-change-credential-wipe into dev-1.7.3 2025-10-09 04:23:44 +00:00
2 changed files with 2 additions and 7 deletions
Showing only changes of commit 51978e94cc - Show all commits

View File

@@ -1339,6 +1339,7 @@ router.post("/complete-reset", async (req, res) => {
},
);
await authManager.registerUser(userId, newPassword);
authManager.logoutUser(userId);
} else {
authLogger.success(
`Password reset completed for user: ${username}. Data preserved using existing session.`,

View File

@@ -286,8 +286,7 @@ class UserCrypto {
newKEK.fill(0);
// Create a copy of DEK for the session before zeroing it out
const dekCopy = Buffer.allocUnsafe(DEK.length);
DEK.copy(dekCopy);
const dekCopy = Buffer.from(DEK);
// Keep user session active with the same DEK
const now = Date.now();
@@ -330,11 +329,6 @@ class UserCrypto {
return false;
}
const kekSalt = await this.getKEKSalt(userId);
if (!kekSalt) {
return false;
}
// Generate new KEK from new password
const newKekSalt = await this.generateKEKSalt();
const newKEK = this.deriveKEK(newPassword, newKekSalt);