config: don't save "hidden wallet" paths in CURRENT_WALLET cv
What changed, and why it matters
This commit fixes a privacy leak in the Electrum wallet app. Previously, if a user opened a 'hidden wallet' (one whose filename starts with a dot, like a secret file), Electrum would remember it as the last-used wallet and could reopen it automatically on Android startup. It would also appear in the recent wallets list. The change makes Electrum forget these hidden wallets so they don't resurface automatically or show up in recents, protecting the user's choice to keep them discreet.
Users who rely on hidden wallets should upgrade to a version containing this commit, especially on Android. Review whether any existing config files already contain hidden wallet paths in `current_wallet` or recent files and clear them if desired. No immediate active-exploitation response is required; this is a defense-in-depth/privacy hardening fix.
Security signals we found
Privacy leak: hidden wallet filename persisted in config and could be auto-reopened
Information disclosure: hidden wallet path exposed in recently-opened list
Behavioral fix: setter silently drops sensitive value rather than persisting it
Android-specific impact: automatic reopening at app launch increases exposure
Evidence from the diff
The patch adds a helper util.is_hidden_wallet_path() that treats any wallet path whose basename starts with ‘.’ as hidden. It then uses this helper in two places: (1) simple_config.CURRENT_WALLET now has a convert_setter that silently drops hidden wallet paths instead of persisting them as the current wallet, and (2) Daemon.update_recently_opened_wallets() skips adding/removing hidden wallet paths from the recents list. This prevents hidden wallets from being auto-opened on Android launch and from being exposed via UI recents.
Changed components
electrum/simple_config.py: CURRENT_WALLET ConfigVarelectrum/daemon.py: Daemon.update_recently_opened_wallets()electrum/util.py: new is_hidden_wallet_path() helperInspect captured patch +14 / −2
diff --git a/electrum/daemon.py b/electrum/daemon.py
index 0a52731..0ea2f53 100644
--- a/electrum/daemon.py
+++ b/electrum/daemon.py
@@ -768,7 +768,9 @@ class Daemon(Logger):
old_password=old_password, new_password=new_password, wallet_dir=wallet_dir)
return True
- def update_recently_opened_wallets(self, wallet_path, *, remove: bool = False):
+ def update_recently_opened_wallets(self, wallet_path, *, remove: bool = False) -> None:
+ if util.is_hidden_wallet_path(wallet_path):
+ return None # don't save "hidden wallet" paths
recent = self.config.RECENTLY_OPEN_WALLET_FILES or []
if wallet_path in recent:
recent.remove(wallet_path)
diff --git a/electrum/simple_config.py b/electrum/simple_config.py
index cf76ffa..b793eaf 100644
--- a/electrum/simple_config.py
+++ b/electrum/simple_config.py
@@ -797,7 +797,10 @@ Warning: setting this to too low will result in lots of payment failures."""),
DISABLE_MEMORY_HARDENING_LINUX = ConfigVar('nohardening', default=None, type_=bool) # default is False in add_global_options
GUI_NAME = ConfigVar('gui', default='qt', type_=str)
- CURRENT_WALLET = ConfigVar('current_wallet', default=None, type_=str)
+ CURRENT_WALLET = ConfigVar(
+ 'current_wallet', default=None, type_=str,
+ convert_setter=lambda v: None if util.is_hidden_wallet_path(v) else v, # don't save "hidden wallet" paths
+ )
GUI_QT_COLOR_THEME = ConfigVar(
'qt_gui_color_theme', default='default', type_=str,
diff --git a/electrum/util.py b/electrum/util.py
index a7bad5c..f63e114 100644
--- a/electrum/util.py
+++ b/electrum/util.py
@@ -607,6 +607,13 @@ def get_new_wallet_name(wallet_folder: str) -> str:
return filename
+def is_hidden_wallet_path(wallet_path: Any) -> bool:
+ if not isinstance(wallet_path, str):
+ return False
+ fname = os.path.basename(wallet_path)
+ return fname.startswith(".")
+
+
def is_android_debug_apk() -> bool:
is_android = 'ANDROID_DATA' in os.environ
if not is_android:
Why this scored 48/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.