Skip to content

Commit 34d8416

Browse files
committed
Merge commit '6199033' into HEAD
2 parents 5dc8738 + 6199033 commit 34d8416

2 files changed

Lines changed: 58 additions & 0 deletions

File tree

scripts/generate-test-report.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,16 @@ def parse_junit(path):
646646
'0x swap ETH to ERC-20', 'DEX aggregator swap via 0x protocol.', []),
647647
('E15', 'test_msg_ethereum_cfunc', 'test_sign_execTx',
648648
'Contract function call', 'Generic contract call signing.', []),
649+
('E16', 'test_msg_ethereum_signtx', 'test_ethereum_blind_sign_blocked',
650+
'Blind sign BLOCKED (AdvancedMode OFF)',
651+
'Contract data with AdvancedMode disabled. Device shows BLOCKED screen and refuses to sign. '
652+
'This is the default behavior — blind signing must be explicitly enabled.',
653+
['BLOCKED screen']),
654+
('E17', 'test_msg_ethereum_signtx', 'test_ethereum_blind_sign_allowed',
655+
'Blind sign ALLOWED (AdvancedMode ON)',
656+
'Contract data with AdvancedMode enabled. Device shows BLIND SIGNATURE warning '
657+
'before proceeding. User sees raw data and must explicitly confirm.',
658+
['BLIND SIGNATURE warning']),
649659
]),
650660

651661
('R', 'Ripple (XRP)', '7.0.0',

tests/test_msg_ethereum_signtx.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def test_ethereum_signtx_data(self):
5959
with self.client:
6060
self.client.set_expected_responses(
6161
[
62+
proto.ButtonRequest(code=proto_types.ButtonRequest_Other), # BLIND SIGNATURE warning
6263
proto.ButtonRequest(code=proto_types.ButtonRequest_ConfirmOutput),
6364
proto.ButtonRequest(code=proto_types.ButtonRequest_ConfirmOutput),
6465
proto.ButtonRequest(code=proto_types.ButtonRequest_SignTx),
@@ -106,6 +107,53 @@ def test_ethereum_signtx_data(self):
106107

107108
self.client.apply_policy("AdvancedMode", 0)
108109

110+
def test_ethereum_blind_sign_blocked(self):
111+
"""AdvancedMode OFF + contract data = device refuses to sign.
112+
113+
OLED shows 'BLOCKED — Blind signing is disabled' before returning Failure.
114+
This is the default behavior — users must explicitly enable AdvancedMode.
115+
"""
116+
self.requires_fullFeature()
117+
self.setup_mnemonic_nopin_nopassphrase()
118+
self.client.apply_policy("AdvancedMode", 0)
119+
120+
try:
121+
self.client.ethereum_sign_tx(
122+
n=[0, 0],
123+
nonce=0,
124+
gas_price=20,
125+
gas_limit=20,
126+
to=binascii.unhexlify("1d1c328764a41bda0492b66baa30c4a339ff85ef"),
127+
value=0,
128+
data=b"abcdefghijklmnop" * 16,
129+
)
130+
self.fail("Expected Failure — blind signing should be blocked")
131+
except CallException as e:
132+
self.assertIn("Blind signing disabled", str(e))
133+
134+
def test_ethereum_blind_sign_allowed(self):
135+
"""AdvancedMode ON + contract data = device shows BLIND SIGNATURE warning.
136+
137+
OLED shows 'BLIND SIGNATURE — You are signing raw contract data'
138+
before showing the data and allowing signing.
139+
"""
140+
self.requires_fullFeature()
141+
self.setup_mnemonic_nopin_nopassphrase()
142+
self.client.apply_policy("AdvancedMode", 1)
143+
144+
sig_v, sig_r, sig_s = self.client.ethereum_sign_tx(
145+
n=[0, 0],
146+
nonce=0,
147+
gas_price=20,
148+
gas_limit=20,
149+
to=binascii.unhexlify("1d1c328764a41bda0492b66baa30c4a339ff85ef"),
150+
value=0,
151+
data=b"abcdefghijklmnop" * 16,
152+
)
153+
# Should succeed — AdvancedMode allows blind signing
154+
self.assertIsNotNone(sig_v)
155+
self.client.apply_policy("AdvancedMode", 0)
156+
109157
def test_ethereum_signtx_message(self):
110158
self.requires_fullFeature()
111159
self.setup_mnemonic_nopin_nopassphrase()

0 commit comments

Comments
 (0)