What changed, and why it matters
This commit is a small code-quality patch that fixes type hints and one error message in Electrum's plugin loader. It does not appear to fix a security vulnerability. The most notable change is that a missing plugin icon now raises a clearer exception instead of returning None, which is a behavior change but not a security-relevant one.
No security action required. Treat as routine code maintenance.
Security signals we found
No security-relevant signal detected in the diff or commit message.
Change from returning None to raising an exception on missing plugin metadata is a behavior change, not a vulnerability fix.
Type-hint correction does not alter runtime behavior.
Evidence from the diff
The diff modifies electrum/plugin.py with three changes: (1) load_plugin_by_name’s return type is corrected from BasePlugin to Optional[BasePlugin] and its early return changed from bare ‘return’ to ‘return None’; (2) derive_privkey is decorated with @staticmethod (it still takes a ‘self’ parameter, which is now a naming bug rather than a real method); (3) read_plugin_metadata raises an explicit exception when a plugin is not found instead of returning None. None of these changes are security fixes; they are type-hint corrections and minor error-handling improvements.
Changed components
electrum/plugin.pyPlugins.load_plugin_by_namePlugins.derive_privkeyPlugins.read_plugin_metadataInspect captured patch +4 / −4
diff --git a/electrum/plugin.py b/electrum/plugin.py
index ed1bbae..c6acac6 100644
--- a/electrum/plugin.py
+++ b/electrum/plugin.py
@@ -610,9 +610,9 @@ class Plugins(DaemonThread):
self.exec_module_from_spec(init_spec, base_name)
- def load_plugin_by_name(self, name: str) -> 'BasePlugin':
+ def load_plugin_by_name(self, name: str) -> Optional['BasePlugin']:
if not self.is_authorized(name):
- return
+ return None
if name in self.plugins:
return self.plugins[name]
# if the plugin was not enabled on startup the init module hasn't been loaded yet
@@ -639,6 +639,7 @@ class Plugins(DaemonThread):
def close_plugin(self, plugin):
self.remove_jobs(plugin.thread_jobs())
+ @staticmethod
def derive_privkey(self, pw: str, salt:bytes) -> ECPrivkey:
from hashlib import pbkdf2_hmac
secret = pbkdf2_hmac('sha256', pw.encode('utf-8'), salt, iterations=10**5)
@@ -809,8 +810,7 @@ class Plugins(DaemonThread):
with open(path, 'rb') as myfile:
return myfile.read()
else:
- # no icon
- return None
+ raise Exception(f"plugin not found: {name!r}")
def get_file_hash256(path: str) -> bytes:
Why this scored 18/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.