SIGHASH gating: status screen on disabled rejection - tests
What changed, and why it matters
This commit only adds a new automated test that checks the on-device error screen shown when a user tries to sign a Bitcoin transaction with a non-standard SIGHASH type while the non-standard SIGHASH setting is disabled. It does not change the app's actual signing behavior or security logic; it only verifies that the existing rejection screen appears correctly.
No security action required; treat as routine test improvement.
Security signals we found
Test-only change
Verifies existing rejection of non-standard SIGHASH when setting disabled
No modification to signing/gating code
Evidence from the diff
The diff extends tests/test_sighash_setting.py with a helper assert_disabled_sighash_screen() and updates test_sighash_none_rejected_by_default() to capture and compare the rejection UI snapshot after the expected APDU error (EC_SIGN_PSBT_NONDEFAULT_SIGHASH_NOT_ALLOWED). The production gating logic and error code are already present; this commit is purely test coverage/UI verification.
Changed components
tests/test_sighash_setting.pyInspect captured patch +19 / −1
diff --git a/tests/test_sighash_setting.py b/tests/test_sighash_setting.py
index b03d896..96a5c2c 100644
--- a/tests/test_sighash_setting.py
+++ b/tests/test_sighash_setting.py
@@ -67,13 +67,28 @@ def open_psbt_from_file(filename: str) -> PSBT:
return psbt
+def assert_disabled_sighash_screen(navigator: Navigator, default_screenshot_path: Path,
+ test_name: str):
+ """Capture and compare the rejection screen ("Non-standard signing rules are
+ disabled in settings").
+
+ The error SW is returned fire-and-forget, so sign_psbt's navigation flow does
+ not capture this screen. It stays up (~3s) after the SW, so we snapshot it here:
+ navigate_and_compare with no instructions waits for the screen to be shown,
+ pauses the auto-dismiss ticker so it cannot race, and compares snapshot 0 with
+ the golden image (honoring --golden_run).
+ """
+ navigator.navigate_and_compare(default_screenshot_path, test_name, [],
+ screen_change_before_first_instruction=True)
+
+
# =========================================================================
# Tests: Default behavior (setting disabled) - non-standard sighash REJECTED
# =========================================================================
def test_sighash_none_rejected_by_default(navigator: Navigator, firmware: Firmware,
- client: RaggerClient, test_name: str):
+ client: RaggerClient, test_name: str, default_screenshot_path: Path):
"""SIGHASH_NONE should be rejected when the non-standard sighash setting is disabled (default)."""
psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-none-sign.psbt")
@@ -86,6 +101,9 @@ def test_sighash_none_rejected_by_default(navigator: Navigator, firmware: Firmwa
error_code = int.from_bytes(e.value.data, 'big')
assert error_code == EC_SIGN_PSBT_NONDEFAULT_SIGHASH_NOT_ALLOWED
+ # Verify the on-device rejection screen is shown to the user
+ assert_disabled_sighash_screen(navigator, default_screenshot_path, test_name)
+
def test_sighash_single_rejected_by_default(navigator: Navigator, firmware: Firmware,
client: RaggerClient, test_name: str):
Why this scored 12/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.