Skip to content

Commit 8fbef43

Browse files
Merge pull request #188 from keepkey/fix/hotfixes-714
2 parents 2f8ca86 + 6018220 commit 8fbef43

4 files changed

Lines changed: 31 additions & 57 deletions

File tree

scripts/generate-test-report.py

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -779,12 +779,11 @@ def parse_junit(path):
779779
('V', 'EVM Clear-Signing', '7.14.0',
780780
'NEW: Verified transaction metadata for EVM contracts. Host sends a signed blob with contract '
781781
'name, function, and decoded parameters. Device verifies blob signature against trusted key, '
782-
'then shows human-readable details with VERIFIED icon. AdvancedMode policy gates blind-signing '
783-
'(disabled by default = blind signing blocked).',
782+
'then shows human-readable details with VERIFIED icon. Blind-sign policy gating is deferred '
783+
'to firmware 7.15+.',
784784
[
785785
'CLEAR-SIGN: Signed metadata -> verify signature -> VERIFIED icon + method + decoded args',
786-
'BLIND BLOCKED: No metadata + AdvancedMode off -> device refuses',
787-
'BLIND ALLOWED: No metadata + AdvancedMode on -> warning -> sign',
786+
'BLIND SIGN: No metadata + AdvancedMode on -> contract data signed (no gate until 7.15+)',
788787
],
789788
[
790789
('V1', 'test_msg_ethereum_clear_signing', 'test_valid_metadata_returns_verified',
@@ -800,22 +799,17 @@ def parse_junit(path):
800799
'Tampered contract rejected', 'Modified contract address fails signature check.', []),
801800
('V5', 'test_msg_ethereum_clear_signing', 'test_no_metadata_then_sign_unchanged',
802801
'No metadata = blind sign path',
803-
'Without metadata, transaction goes through blind-sign path (gated by AdvancedMode).',
802+
'Without metadata, transaction goes through existing blind-sign path.',
804803
['Blind sign warning']),
805804
('V6', 'test_msg_ethereum_clear_signing', 'test_signature_verification',
806805
'Signature verification math', 'Unit test for the metadata blob signature algorithm.', []),
807806
('V7', 'test_msg_ethereum_clear_signing', 'test_tampered_blob_fails_verification',
808807
'Tampered blob fails', 'Any byte change in the blob invalidates the signature.', []),
809-
('V8', 'test_msg_ethereum_signtx', 'test_ethereum_blind_sign_blocked',
810-
'Blind sign BLOCKED (AdvancedMode OFF)',
811-
'Contract data with AdvancedMode disabled. Device shows BLOCKED screen and refuses to sign. '
812-
'This is the default behavior -- blind signing must be explicitly enabled.',
813-
['BLOCKED screen']),
814-
('V9', 'test_msg_ethereum_signtx', 'test_ethereum_blind_sign_allowed',
815-
'Blind sign ALLOWED (AdvancedMode ON)',
816-
'Contract data with AdvancedMode enabled. Device shows BLIND SIGNATURE warning '
817-
'before proceeding. User sees raw data and must explicitly confirm.',
818-
['BLIND SIGNATURE warning']),
808+
('V8', 'test_msg_ethereum_signtx', 'test_ethereum_blind_sign_allowed',
809+
'Blind sign permitted (AdvancedMode ON)',
810+
'Contract data with AdvancedMode enabled. Device allows signing. '
811+
'Blind-sign blocking deferred to 7.15+.',
812+
[]),
819813
]),
820814

821815
('S', 'Solana', '7.14.0',
@@ -863,13 +857,11 @@ def parse_junit(path):
863857
]),
864858

865859
('T', 'TRON', '7.14.0',
866-
'NEW: TRON with protobuf deserialization and reconstruct-then-sign. 13 hardcoded TRC-20 tokens. '
867-
'Device reconstructs tx hash from parsed fields (not raw blob) for clear-sign path.',
860+
'NEW: TRON with secp256k1 signing, base58 addresses. Blind-sign via raw_data. '
861+
'Structured reconstruct-then-sign and TRC-20 clear-signing deferred to 7.15+.',
868862
[
869863
'ADDRESS: m/44\'/195\'/0\'/0/0 -> full 34-char base58 TRON address',
870-
'STRUCTURED: Parse fields -> reconstruct hash -> show amount + address -> sign',
871-
'TRC-20: Decode transfer(to,amount) ABI -> show token name + decoded amount',
872-
'LEGACY: Raw protobuf -> blind sign warning',
864+
'BLIND-SIGN: Raw protobuf data -> hash + sign',
873865
],
874866
[
875867
('T1', 'test_msg_tron_getaddress', 'test_tron_get_address',
@@ -880,13 +872,9 @@ def parse_junit(path):
880872
'Deterministic derivation', 'Same path always produces same address.', []),
881873
('T3b', 'test_msg_tron_getaddress', 'test_tron_show_address',
882874
'Show address on OLED', 'Full 34-char Base58Check TRON address with QR code.', ['TRON QR + 34-char address']),
883-
('T4', 'test_msg_tron_signtx', 'test_tron_sign_transfer_structured',
884-
'Sign TRX transfer', 'Structured clear-sign with full address display.', ['TRX send']),
885-
('T5', 'test_msg_tron_signtx', 'test_tron_sign_transfer_legacy_raw_data',
886-
'Sign TRX legacy raw', 'Raw protobuf data triggers blind sign path.', ['Blind sign']),
887-
('T6', 'test_msg_tron_signtx', 'test_tron_sign_trc20_transfer',
888-
'Sign TRC-20 USDT transfer', 'Known TRC-20 token decoded from ABI data. Shows "Send 1.00 USDT to [address]".', ['Token + amount']),
889-
('T7', 'test_msg_tron_signtx', 'test_tron_sign_missing_fields_rejected',
875+
('T4', 'test_msg_tron_signtx', 'test_tron_sign_transfer_legacy_raw_data',
876+
'Sign TRX blind (raw_data)', 'Raw protobuf data triggers blind sign path.', ['Blind sign']),
877+
('T5', 'test_msg_tron_signtx', 'test_tron_sign_missing_fields_rejected',
890878
'Missing fields rejected', 'Incomplete transaction data is refused.', []),
891879
]),
892880

tests/test_msg_ethereum_signtx.py

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -95,36 +95,13 @@ def test_ethereum_signtx_data(self):
9595

9696
self.client.apply_policy("AdvancedMode", 0)
9797

98-
def test_ethereum_blind_sign_blocked(self):
99-
"""AdvancedMode OFF + contract data = device refuses to sign.
100-
101-
OLED shows 'BLOCKED -- Blind signing requires AdvancedMode' then Failure.
102-
"""
103-
self.requires_firmware("7.14.0")
104-
self.setup_mnemonic_nopin_nopassphrase()
105-
self.client.apply_policy("AdvancedMode", 0)
106-
107-
try:
108-
self.client.ethereum_sign_tx(
109-
n=[0, 0],
110-
nonce=0,
111-
gas_price=20,
112-
gas_limit=20,
113-
to=binascii.unhexlify("1d1c328764a41bda0492b66baa30c4a339ff85ef"),
114-
value=0,
115-
data=b"abcdefghijklmnop" * 16,
116-
)
117-
self.fail("Expected Failure — blind signing should be blocked")
118-
except CallException as e:
119-
self.assertIn("Blind signing disabled", str(e))
120-
12198
def test_ethereum_blind_sign_allowed(self):
122-
"""AdvancedMode ON + contract data = device shows BLIND SIGNATURE warning.
99+
"""Contract data = device allows blind signing (no gate until 7.15+).
123100
124-
OLED shows 'BLIND SIGNATURE -- You are signing raw contract data'
125-
before showing the data and allowing signing.
101+
Blind-sign policy gating (AdvancedMode) is deferred to firmware 7.15+.
102+
On 7.10-7.14 blind signing is always permitted with AdvancedMode ON.
126103
"""
127-
self.requires_firmware("7.14.0")
104+
self.requires_fullFeature()
128105
self.setup_mnemonic_nopin_nopassphrase()
129106
self.client.apply_policy("AdvancedMode", 1)
130107

@@ -137,7 +114,6 @@ def test_ethereum_blind_sign_allowed(self):
137114
value=0,
138115
data=b"abcdefghijklmnop" * 16,
139116
)
140-
# Should succeed — AdvancedMode allows blind signing
141117
self.assertIsNotNone(sig_v)
142118
self.client.apply_policy("AdvancedMode", 0)
143119

tests/test_msg_solana_signtx.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ def build_system_transfer_tx(from_pubkey, to_pubkey, lamports, blockhash=None):
2727

2828
tx = bytearray()
2929

30+
# Signature count (compact-u16: 0 signatures for unsigned tx)
31+
tx.append(0)
32+
3033
# Header
3134
tx.append(1) # num_required_sigs
3235
tx.append(0) # num_readonly_signed
@@ -191,6 +194,7 @@ def _build_tx(self, from_pubkey, accounts, program_id, instr_data, extra_account
191194
all_accounts = [from_pubkey] + (extra_accounts or []) + accounts + [program_id]
192195
blockhash = b'\xBB' * 32
193196
tx = bytearray()
197+
tx.append(0) # signature count (compact-u16: 0 = unsigned)
194198
tx.append(1) # num_required_sigs
195199
tx.append(0) # num_readonly_signed
196200
tx.append(1 + len(accounts) + (len(extra_accounts) if extra_accounts else 0)) # num_readonly_unsigned

tests/test_msg_tron_signtx.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@ def test_tron_get_address(self):
4848
self.assertTrue(resp.address.startswith('T'))
4949
self.assertEqual(len(resp.address), 34)
5050

51+
@unittest.skip("Structured TRON signing deferred to 7.15+; firmware only supports raw_data blind-sign")
5152
def test_tron_sign_transfer_structured(self):
52-
"""Test TRX transfer using structured fields (reconstruct-then-sign)."""
53+
"""Test TRX transfer using structured fields (reconstruct-then-sign).
54+
Deferred to 7.15+ — firmware currently only supports raw_data path.
55+
"""
5356
self.requires_fullFeature()
5457
self.setup_mnemonic_allallall()
5558

@@ -112,8 +115,11 @@ def test_tron_sign_missing_fields_rejected(self):
112115
with pytest.raises(CallException) as exc:
113116
self.client.call(msg)
114117

118+
@unittest.skip("Structured TRON TRC-20 signing deferred to 7.15+; firmware only supports raw_data blind-sign")
115119
def test_tron_sign_trc20_transfer(self):
116-
"""Test TRC-20 USDT transfer using trigger_smart."""
120+
"""Test TRC-20 USDT transfer using trigger_smart.
121+
Deferred to 7.15+ — firmware currently only supports raw_data path.
122+
"""
117123
self.requires_fullFeature()
118124
self.setup_mnemonic_allallall()
119125

0 commit comments

Comments
 (0)