@@ -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