Remove the psbt_parser reset from the input verification failure handler
What changed, and why it matters
This commit removes a safety cleanup that wiped out an internal PSBT parser when the device detected it couldn't verify the bitcoin amounts in a transaction. The change itself is small, but it eliminates a defensive guard that prevented a stale parser from being reused. The accompanying test that documented this defensive behavior was also deleted. The commit message does not explain why removing the cleanup is safe, so the security relevance is unclear from the diff alone.
Review whether controller.psbt_parser can remain stale or inconsistent after PSBTOverviewView redirects to PSBTInputAmountVerificationFailedView. If another view or later flow step can read fee data from controller.psbt_parser, restore the nullification or add an equivalent cleanup. Re-add a test covering the stale-parser scenario unless the team can demonstrate the state is unreachable or safely handled elsewhere.
Security signals we found
Removal of defensive nullification of sensitive object (controller.psbt_parser)
Deletion of unit test that explicitly described the cleanup as a security/defensive measure
Error handler continues to redirect user but no longer sanitizes shared controller state
No replacement cleanup or rationale provided in commit message
Evidence from the diff
In seedsigner/views/psbt_views.py, the PSBTOverviewView error handler for PSBTInputAmountVerificationError no longer sets controller.psbt_parser = None. The deleted test asserted that on input verification failure the stale parser is cleared so a later view cannot read a fee from it. The commit removes both the cleanup and the test, leaving controller.psbt_parser in whatever state it was in when verification fails. The commit message only says ‘Remove the psbt_parser reset from the input verification failure handler’ and offers no rationale or replacement defense.
Changed components
src/seedsigner/views/psbt_views.pytests/test_flows_psbt.pyPSBTOverviewView input verification failure handlerController.psbt_parser stateInspect captured patch +1 / −44
### src/seedsigner/views/psbt_views.py
@@ -148,7 +148,6 @@ def __init__(self):
# The declared input amounts could not be verified, so the fee we would show is unproven
# Set clear_history to disable returning via BACK button.
logger.error(f"PSBT input amount verification failed: {e}")
- self.controller.psbt_parser = None
self.set_redirect(Destination(PSBTInputAmountVerificationFailedView, clear_history=True))
return
### tests/test_flows_psbt.py
@@ -1,15 +1,13 @@
from binascii import a2b_base64
-from unittest.mock import Mock
from embit import bip32, script
from embit.psbt import PSBT, DerivationPath
-from base import BaseTest, FlowTest, FlowStep
+from base import FlowTest, FlowStep
from psbt_testing_util import (PSBTTestData, claim_seed_owns_key, create_output,
foreign_public_key, root_for_seed)
from seedsigner.controller import Controller
-from seedsigner.models.psbt_parser import PSBTParser
from seedsigner.views.view import MainMenuView
from seedsigner.views import scan_views, seed_views, psbt_views
from seedsigner.models.seed import Seed
@@ -398,43 +396,3 @@ def test_wrong_seed_routes_back_to_seed_selection_flow(self):
# The psbt itself is kept: the user is choosing a different seed for it, not
# starting over
assert self.controller.psbt is not None
-
-
-
-class TestPSBTOverviewView(BaseTest):
- """
- View-level tests for the parts of PSBTOverviewView that a FlowTest can't reach.
- """
-
- def test_stale_psbt_parser_is_cleared_on_input_verification_failure(self):
- """
- The error handler nulls controller.psbt_parser so an unusable parser can't be left
- behind for a later view to read a fee from.
-
- This is defensive: ScanView already nulls psbt_parser whenever it sets a new psbt
- (scan_views.py), so no real flow reaches PSBTOverviewView with a stale parser in
- place. That's precisely why this is tested here and not in a flow — the state has to
- be constructed by hand, and asserting it inside a flow would only ever be checking
- ScanView's cleanup rather than the handler's.
- """
- self.settings.set_value(SettingsConstants.SETTING__NETWORK, SettingsConstants.REGTEST)
-
- psbt = PSBT.parse(a2b_base64(PSBTTestData.SINGLE_SIG_NATIVE_SEGWIT_2_INPUTS))
- psbt.inputs[0].non_witness_utxo.vout[0].value += 100_000
-
- self.controller.psbt = psbt
- self.controller.psbt_seed = PSBTTestData.two_input_seed
-
- # Stand in for a parser left over from a previously-viewed psbt. Its seed differs from
- # psbt_seed, so PSBTOverviewView will re-parse rather than reuse it.
- self.controller.psbt_parser = Mock(spec=PSBTParser, seed=PSBTTestData.seed)
- assert self.controller.psbt_parser.seed != self.controller.psbt_seed
-
- view = psbt_views.PSBTOverviewView()
-
- assert self.controller.psbt_parser is None
-
- # The view redirects away from the overview rather than rendering an unproven fee.
- # Destination._run_view() honors this before run() is ever called.
- assert view.has_redirect
- assert view.get_redirect().View_cls is psbt_views.PSBTInputAmountVerificationFailedViewWhy this scored 24/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.