What changed, and why it matters
This is a small code cleanup change. It makes the `start()` method of several wizard classes accept its `initial_data` argument only as a named (keyword) argument, not as a positional argument. This prevents accidental misuse and makes it easier for developers to see where initial data is actually coming from. There is no security vulnerability being fixed here.
No security action needed. Treat as normal code maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit changes the signature of start() in four wizard classes (KeystoreWizard, NewWalletWizard, ServerConnectWizard, TermsOfUseWizard) from start(self, initial_data: dict = None) to start(self, *, initial_data: dict = None). The * forces initial_data to be passed as a keyword argument. The only call site in the test suite is updated accordingly from w.start({'wallet_type': wallet_type}) to w.start(initial_data={'wallet_type': wallet_type}). This is a refactoring for code clarity and API safety, not a security patch.
Changed components
electrum/wizard.pytests/test_wizard.pyInspect captured patch +5 / −5
diff --git a/electrum/wizard.py b/electrum/wizard.py
index ae624a1..34aea66 100644
--- a/electrum/wizard.py
+++ b/electrum/wizard.py
@@ -257,7 +257,7 @@ class KeystoreWizard(AbstractWizard):
# one at a time
return True
- def start(self, initial_data: dict = None) -> WizardViewState:
+ def start(self, *, initial_data: dict = None) -> WizardViewState:
if initial_data is None:
initial_data = {}
self.reset()
@@ -487,7 +487,7 @@ class NewWalletWizard(KeystoreWizard):
# todo: load only if needed, like hw plugins
self.plugins.load_plugin_by_name('trustedcoin')
- def start(self, initial_data: dict = None) -> WizardViewState:
+ def start(self, *, initial_data: dict = None) -> WizardViewState:
if initial_data is None:
initial_data = {}
self.reset()
@@ -861,7 +861,7 @@ class ServerConnectWizard(AbstractWizard):
if wizard_data.get('autoconnect') is not None:
self._daemon.config.NETWORK_AUTO_CONNECT = wizard_data.get('autoconnect')
- def start(self, initial_data: dict = None) -> WizardViewState:
+ def start(self, *, initial_data: dict = None) -> WizardViewState:
if initial_data is None:
initial_data = {}
self.reset()
@@ -888,7 +888,7 @@ class TermsOfUseWizard(AbstractWizard):
def accept_terms_of_use(self, _):
self._config.TERMS_OF_USE_ACCEPTED = TERMS_OF_USE_LATEST_VERSION
- def start(self, initial_data: dict = None) -> WizardViewState:
+ def start(self, *, initial_data: dict = None) -> WizardViewState:
if initial_data is None:
initial_data = {}
self.reset()
diff --git a/tests/test_wizard.py b/tests/test_wizard.py
index dbe54f7..068e915 100644
--- a/tests/test_wizard.py
+++ b/tests/test_wizard.py
@@ -140,7 +140,7 @@ class KeystoreWizardTestCase(WizardTestCase):
def _wizard_for(self, *, wallet_type: str = 'standard', hww: bool = False) -> tuple[KeystoreWizard, WizardViewState]:
w = KeystoreWizardTestCase.TKeystoreWizard(self.plugins)
- v = w.start({'wallet_type': wallet_type})
+ v = w.start(initial_data={'wallet_type': wallet_type})
self.assertEqual('keystore_type', v.view)
d = v.wizard_data
if hww:
Why this scored 15/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.