fix(security): don't penalise a correct PIN after a passphrase change
A passphrase change left the PIN vault sealing the old passphrase. The next PIN unlock opened the vault, walletpassphrase answered RPC -14, and the generic catch ran the lockout curve on a correct PIN, while Settings kept showing the PIN as active. - Passphrase change: when the active wallet's vault exists at completion (same vault path as at dispatch, passphrase actually changed), the vault is marked out of date for the session and kept on disk: PIN entry is no longer offered, a warning toast says so, and Settings shows "PIN out of date" with a tooltip on how to fix it. The Change Passphrase dialog notes beforehand that a PIN will go out of date. - PIN unlock: RPC -14 after the vault opened is treated as "PIN out of date": passphrase entry, a message, no attempt counted, no lockout, and the vault is not deleted (-14 is only the daemon's answer; the vault may hold the only copy of a passphrase that opens an older backup). After a restart Settings shows the PIN as active until the first PIN attempt. - A malformed vault (zero-filled by a removeVault() whose unlink failed, truncated, unknown version) is treated as missing: passphrase entry, "PIN file unreadable", no penalty. New SecureVault::isWellFormed(). - Race guards: Set/Change/Remove PIN are disabled while a passphrase change runs, and Change Passphrase while a PIN operation runs. - Setting or removing the PIN, or switching wallets, clears the mark; setting a PIN offers PIN entry again. Change PIN keeps the mark (the vault still seals the same passphrase). - Pure decisions in data/pin_vault_policy.h, unit-tested. New strings in all 8 languages. No vault, wallet or settings format change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -591,10 +591,13 @@ void I18n::loadBuiltinEnglish()
|
||||
strings_["settings_unlocked"] = "Unlocked";
|
||||
strings_["settings_quick_unlock_pin"] = "Quick-unlock PIN";
|
||||
strings_["settings_pin_active"] = "PIN";
|
||||
strings_["settings_pin_out_of_date"] = "PIN out of date";
|
||||
strings_["settings_encrypt_first_pin"] = "Encrypt wallet first to enable PIN";
|
||||
strings_["incorrect_pin"] = "Incorrect PIN";
|
||||
strings_["incorrect_passphrase"] = "Incorrect passphrase";
|
||||
strings_["pin_not_set"] = "PIN not set. Use passphrase to unlock.";
|
||||
strings_["sec_pin_stale_msg"] = "PIN out of date. Use your passphrase.";
|
||||
strings_["sec_pin_unreadable"] = "PIN file unreadable. Use your passphrase.";
|
||||
strings_["restarting_after_encryption"] = "Restarting daemon after encryption...";
|
||||
// Stopping the node on quit: deliver stop, wait, never kill unasked
|
||||
strings_["shutdown_leave_running"] = "Close wallet — leave node running";
|
||||
@@ -690,6 +693,7 @@ void I18n::loadBuiltinEnglish()
|
||||
strings_["change_pass_current"] = "Current Passphrase:";
|
||||
strings_["change_pass_new"] = "New Passphrase:";
|
||||
strings_["change_pass_confirm"] = "Confirm New:";
|
||||
strings_["change_pass_pin_note"] = "This wallet has a quick-unlock PIN. After the change it will be out of date: remove the PIN in Settings and set it again.";
|
||||
// --- Remove-encryption (decrypt) dialog (settings) ---
|
||||
strings_["decrypt_title"] = "Remove Wallet Encryption";
|
||||
strings_["decrypt_warning"] = "This will remove encryption from your wallet. Your private keys will be stored unprotected on disk.";
|
||||
@@ -988,6 +992,7 @@ void I18n::loadBuiltinEnglish()
|
||||
strings_["tt_set_pin"] = "Set a 4-8 digit PIN for quick unlock";
|
||||
strings_["tt_change_pin"] = "Change your unlock PIN";
|
||||
strings_["tt_remove_pin"] = "Remove PIN and require passphrase to unlock";
|
||||
strings_["tt_pin_out_of_date"] = "The wallet passphrase changed after this PIN was set, so the PIN can no longer unlock the wallet. Remove the PIN and set it again.";
|
||||
strings_["tt_tx_url"] = "Base URL for viewing transactions in a block explorer";
|
||||
strings_["tt_addr_url"] = "Base URL for viewing addresses in a block explorer";
|
||||
strings_["tt_custom_fees"] = "Enable manual fee entry when sending transactions";
|
||||
@@ -2676,6 +2681,7 @@ void I18n::loadBuiltinEnglish()
|
||||
strings_["sec_couldnt_lock_wallet"] = "Couldn't lock the wallet — it is still unlocked. Check the daemon connection.";
|
||||
strings_["sec_changing_passphrase"] = "Changing passphrase...";
|
||||
strings_["sec_passphrase_changed_successfully"] = "Passphrase changed successfully";
|
||||
strings_["sec_passphrase_changed_pin_stale"] = "Passphrase changed; your PIN is now out of date";
|
||||
strings_["sec_failed_prefix"] = "Failed: ";
|
||||
strings_["sec_encryption_did_not_complete"] = "Wallet encryption did not complete — your wallet is NOT encrypted. Open Settings to finish encrypting it.";
|
||||
strings_["sec_wallet_locked_title"] = "Wallet Locked";
|
||||
|
||||
Reference in New Issue
Block a user