fix: replace removed `get_seed` call in `PSBTSelectSeedView`
What changed, and why it matters
This commit fixes a bug where selecting an existing seed during PSBT signing would crash because the code called a method (`get_seed`) that no longer exists. The fix uses the already-loaded list of seeds directly. The crash is a reliability issue, not a direct theft-of-funds vulnerability, but it could prevent a user from signing a transaction at a critical moment.
No immediate security response required; ensure the regression test passes and consider auditing other removed `get_seed` callers.
Security signals we found
Fixes a runtime exception (AttributeError) in a signing workflow
Prevents workflow failure when user selects an existing seed for PSBT signing
Adds regression test covering the previously broken code path
Evidence from the diff
In PSBTSelectSeedView, the previous code invoked self.controller.get_seed(selected_menu_num), which had been removed elsewhere. The patch replaces it with seeds[selected_menu_num], where seeds is the local list of seeds already enumerated for the menu. A regression test is added to exercise selecting the already-loaded seed in a PSBT flow and assert that controller.psbt_seed is set correctly.
Changed components
src/seedsigner/views/psbt_views.pytests/test_flows_psbt.pyInspect captured patch +13 / −1
diff --git a/src/seedsigner/views/psbt_views.py b/src/seedsigner/views/psbt_views.py
index 475aef4..9e0fbeb 100644
--- a/src/seedsigner/views/psbt_views.py
+++ b/src/seedsigner/views/psbt_views.py
@@ -58,7 +58,7 @@ class PSBTSelectSeedView(View):
if len(seeds) > 0 and selected_menu_num < len(seeds):
# User selected one of the n seeds
- self.controller.psbt_seed = self.controller.get_seed(selected_menu_num)
+ self.controller.psbt_seed = seeds[selected_menu_num]
return Destination(PSBTOverviewView)
# The remaining flows are a sub-flow; resume PSBT flow once the seed is loaded.
diff --git a/tests/test_flows_psbt.py b/tests/test_flows_psbt.py
index 4141e57..1e3067d 100644
--- a/tests/test_flows_psbt.py
+++ b/tests/test_flows_psbt.py
@@ -57,6 +57,18 @@ class TestPSBTFlows(FlowTest):
FlowStep(MainMenuView)
])
+ # Run the same PSBT flow again, this time selecting the seed that the
+ # previous flow left loaded in memory.
+ self.run_sequence([
+ FlowStep(MainMenuView, button_data_selection=MainMenuView.SCAN),
+ FlowStep(scan_views.ScanView, before_run=load_psbt_into_decoder),
+ FlowStep(psbt_views.PSBTSelectSeedView, screen_return_value=0),
+ FlowStep(psbt_views.PSBTOverviewView),
+ ])
+
+ # Selecting the existing seed should have set it as the signing seed
+ assert self.controller.psbt_seed is self.controller.storage.seeds[0]
+
def test_scan_psbt_first_then_load_electrum_seed(self):
"""
Why this scored 43/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.