Using classical NBGL API for message signing - test adaptation
What changed, and why it matters
This commit only updates automated test scripts for Ledger's Bitcoin app. It changes how on-screen button presses are simulated during message-signing tests on newer touch-screen devices, switching from one generic test helper to more specific tap coordinates. There is no change to the actual wallet application code that users run, so this cannot directly affect user funds or security.
No security action required. Treat as a normal test-maintenance change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies two Python files under the Ragger test harness. ragger_bitcoin/ragger_instructions.py simplifies review_message() by removing the page_count parameter. tests/instructions.py updates message_instruction_approve_long() to use device-specific touch coordinates and the classical NBGL review flow for Stax/Flex/Apex devices, while collapsing the Nano sequence. These are purely test-instruction adaptations; no C/Bolos app code, APDU handlers, cryptography, or UI logic in the firmware is touched.
Changed components
tests/instructions.pyragger_bitcoin/ragger_instructions.pyInspect captured patch +22 / −11
diff --git a/ragger_bitcoin/ragger_instructions.py b/ragger_bitcoin/ragger_instructions.py
index 029fc42..e173871 100644
--- a/ragger_bitcoin/ragger_instructions.py
+++ b/ragger_bitcoin/ragger_instructions.py
@@ -70,14 +70,11 @@ class Instructions:
NavInsID.USE_CASE_STATUS_DISMISS,
save_screenshot=save_screenshot)
- def review_message(self, page_count=1, save_screenshot=True):
+ def review_message(self, save_screenshot=True):
self.new_request("Review", NavInsID.USE_CASE_REVIEW_TAP,
NavInsID.USE_CASE_REVIEW_TAP, save_screenshot=save_screenshot)
self.same_request("Message", NavInsID.USE_CASE_REVIEW_TAP,
NavInsID.USE_CASE_REVIEW_TAP, save_screenshot=save_screenshot)
- for _ in range(1, page_count):
- self.new_request("Message", NavInsID.USE_CASE_REVIEW_TAP,
- NavInsID.USE_CASE_REVIEW_TAP, save_screenshot=save_screenshot)
def confirm_message(self, save_screenshot=True):
self.same_request("Sign", NavInsID.USE_CASE_REVIEW_TAP,
diff --git a/tests/instructions.py b/tests/instructions.py
index 832dd7b..e08f0a5 100644
--- a/tests/instructions.py
+++ b/tests/instructions.py
@@ -1,7 +1,8 @@
import pytest
-from ragger.navigator import NavInsID
+from ragger.navigator import NavInsID, NavIns
from ragger.firmware import Firmware
+from ragger.firmware.touch.positions import STAX_X_CENTER, FLEX_X_CENTER, APEX_P_X_CENTER
from ragger_bitcoin.ragger_instructions import Instructions, MAX_EXT_OUTPUT_SIMPLIFIED_NUMBER
@@ -24,13 +25,26 @@ def message_instruction_approve_long(model: Firmware) -> Instructions:
if model.name.startswith("nano"):
instructions.nano_skip_screen("Path")
- instructions.same_request("Loading message")
- instructions.new_request("Loading message")
- instructions.new_request("Loading message")
- instructions.new_request("Loading message")
- instructions.new_request("Sign message")
+ instructions.same_request("Sign message")
else:
- instructions.review_message(page_count=5)
+ # TODO: to wrap below to review_message_long() and
+ # to use coordinates from positions.py when available in Ragger
+ if (model.name == "apex_p"):
+ MORE_POS = (APEX_P_X_CENTER, 250)
+ CROSS_POS = (28, 370)
+ elif model.name == "stax":
+ MORE_POS = (STAX_X_CENTER, 425)
+ CROSS_POS =(40, 625)
+ elif model.name == "flex":
+ MORE_POS = (FLEX_X_CENTER, 365)
+ CROSS_POS = (50, 550)
+
+ instructions.new_request("Review", NavInsID.USE_CASE_REVIEW_TAP,
+ NavInsID.USE_CASE_REVIEW_TAP)
+ instructions.same_request("Message", NavInsID.USE_CASE_REVIEW_TAP,
+ NavIns(NavInsID.TOUCH, MORE_POS))
+ instructions.same_request("Message", NavInsID.USE_CASE_REVIEW_TAP,
+ NavIns(NavInsID.TOUCH, CROSS_POS))
instructions.confirm_message()
return instructions
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.