Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

daemon.load_wallet to raise if given redundant password #8799

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SomberNight
Copy link
Member

  • for a wallet with no password, running commands with a pw given should raise InvalidPassword, instead of ignoring the provided pw
  • and for wallet.unlock, it is very confusing to save the given pw in memory, if the wallet does not actually use a pw

(let's see if tests pass on CI)

- for a wallet with no password, running commands with a pw given should raise
  InvalidPassword, instead of ignoring the provided pw
- and for wallet.unlock, it is very confusing to save the given pw in memory,
  if the wallet does not actually use a pw
Comment on lines +518 to +521
if password:
# if a password was given, we check it.
# e.g. for unpassworded wallet, if given pw, we should raise.
wallet.check_password(password)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ecdsa commented out of band that load_wallet should not care about the keystore, only about the storage (wallet.check_password tests both storage and keystore), and e.g. if a password is given to load_wallet for a wallet that only has keystore encryption, load_wallet should unconditionally raise, even if the provided password matches the keystore

diff --git a/electrum/daemon.py b/electrum/daemon.py
index 4cfd0012db..3225e590d5 100644
--- a/electrum/daemon.py
+++ b/electrum/daemon.py
@@ -510,6 +510,9 @@ class Daemon(Logger):
             if not password:
                 raise InvalidPassword('No password given')
             storage.decrypt(password)
+        else:
+            if password:
+                raise InvalidPassword("password given but wallet storage is not encrypted")
         # read data, pass it to db
         db = WalletDB(storage.read(), storage=storage, upgrade=upgrade)
         if db.get_action():

@SomberNight SomberNight marked this pull request as draft January 17, 2024 03:22
ecdsa added a commit that referenced this pull request Jun 8, 2024
- the unlock command was replaced by an option to load_wallet,
because some applications (the swapserver plugin) need to be
executed with an unlocked password. Now the swapserver plugin
waits until the wallet is unlocked.
- wallet.unlock now checks password unconditionally, see #8799
@spesmilo spesmilo deleted a comment from Necmeddinhammami Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant