WizardController: set password before storing wallet
What changed, and why it matters
This commit moves the wallet password setup so it happens right before the wallet file is saved, instead of earlier during wallet creation cleanup. The change likely fixes a bug where a wallet could be stored to disk without a password, leaving it unprotected. However, the diff is small and the commit message does not explicitly call this a security fix, so the exact risk depends on surrounding code not shown here.
Review the full WizardController.qml flow to confirm storeAsync cannot be reached through any other path before setPassword is called, and verify that wallets created with this code are indeed password-protected on disk. Consider adding an explicit guard or assertion that storeAsync refuses to save a wallet whose password has not been set.
Security signals we found
Password-protection logic reordered to occur before wallet persistence
Change touches wallet creation/storage flow
No explicit security framing in commit message
Evidence from the diff
In WizardController.qml, the call to m_wallet.setPassword(walletOptionsPassword) was removed from a cleanup/transition block and inserted immediately before m_wallet.storeAsync(handler, new_wallet_filename). This ensures the password is set on the in-memory wallet object before the asynchronous store operation writes the wallet file. If the previous ordering allowed storeAsync to run without a password (for example, if the cleanup block was not always reached, or if storeAsync was triggered elsewhere), wallets may have been persisted without password protection.
Changed components
wizard/WizardController.qmlwallet creation/storage flowInspect captured patch +1 / −3
diff --git a/wizard/WizardController.qml b/wizard/WizardController.qml
index eb72709..a7932fd 100644
--- a/wizard/WizardController.qml
+++ b/wizard/WizardController.qml
@@ -378,9 +378,6 @@ Rectangle {
console.log("Removing temporary wallet: " + wizardController.tmpWalletFilename)
oshelper.removeTemporaryWallet(wizardController.tmpWalletFilename)
- // protecting wallet with password
- wizardController.m_wallet.setPassword(wizardController.walletOptionsPassword);
-
// save to persistent settings
persistentSettings.account_name = wizardController.walletOptionsName
persistentSettings.wallet_path = wizardController.m_wallet.path;
@@ -399,6 +396,7 @@ Rectangle {
new_wallet_filename = appWindow.accountsDir + new_wallet_filename;
}
console.log("saving new wallet to", new_wallet_filename);
+ wizardController.m_wallet.setPassword(wizardController.walletOptionsPassword);
wizardController.m_wallet.storeAsync(handler, new_wallet_filename);
}
Why this scored 57/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.