Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion tests/test_msg_eos_signtx.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,15 @@ def test_updateauth(self):
num_actions=1),
[self.action_updateauth(True)])

self.assertEqual(binascii.hexlify(res.hash), "fb936ef1be4bda680d93bd10b6d062357d8dd7272038a706dc0d61a91f39c5ee")
# Firmware 7.15 serializes waits_count here. Older firmware hashed a
# phantom zero wait by iterating accounts_count instead.
version = (self.client.features.major_version,
self.client.features.minor_version,
self.client.features.patch_version)
expected = ("5938294e65cf9e8b5dd5f2b204503b4825f277e6f4a2d5ab7a55a31065a23af1"
if version >= (7, 15, 0)
else "fb936ef1be4bda680d93bd10b6d062357d8dd7272038a706dc0d61a91f39c5ee")
self.assertEqual(binascii.hexlify(res.hash), expected)

def test_deleteauth(self):
self.requires_fullFeature()
Expand Down
1 change: 1 addition & 0 deletions tests/test_msg_ethereum_erc20_approve.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def test_approve_cvc_0(self):

def test_approve_cvc_all(self):
self.requires_fullFeature()
self.requires_firmware("7.15.0")
self.setup_mnemonic_nopin_nopassphrase()

with self.assertRaises(CallException) as caught:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_msg_ethereum_erc20_uniswap_liquidity.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TestMsgEthereumUniswaptxERC20(common.KeepKeyTest):

def test_sign_uni_approve_liquidity_ETH(self):
self.requires_fullFeature()
self.requires_firmware("7.1.0")
self.requires_firmware("7.15.0")
self.setup_mnemonic_nopin_nopassphrase()

self.client.apply_policy("AdvancedMode", 1)
Expand Down
1 change: 1 addition & 0 deletions tests/test_msg_signtx_ethereum_erc20.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def test_approve_some(self):

def test_approve_all(self):
self.requires_fullFeature()
self.requires_firmware("7.15.0")
self.setup_mnemonic_nopin_nopassphrase()

with self.assertRaises(CallException) as caught:
Expand Down
26 changes: 23 additions & 3 deletions tests/test_msg_solana_signtx.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def setUp(self):
def setup_mnemonic_allallall(self):
policy_negative = self._testMethodName in {
"test_solana_sign_message_blocked_without_advanced_mode",
"test_solana_sign_plain_text_message_without_advanced_mode",
"test_solana_sign_malformed_bad_account_count",
"test_solana_sign_versioned_v0_opaque",
}
Expand Down Expand Up @@ -153,9 +154,11 @@ def test_solana_sign_message(self):
self.client.apply_policy('AdvancedMode', False)

def test_solana_sign_message_blocked_without_advanced_mode(self):
"""Solana message signing BLOCKED without AdvancedMode.
"""Non-text Solana message signing BLOCKED without AdvancedMode.
Without domain separation, a signed message is indistinguishable from
a signed transaction. Device refuses to sign without explicit opt-in."""
a signed transaction. Device refuses to sign without explicit opt-in.
The payload is binary so this remains true when bounded plain text is
allowed."""
self.requires_firmware("7.14.0")
self.requires_fullFeature()
self.requires_message("SolanaSignMessage")
Expand All @@ -165,10 +168,27 @@ def test_solana_sign_message_blocked_without_advanced_mode(self):
with pytest.raises(CallException) as exc:
self.client.call(messages.SolanaSignMessage(
address_n=parse_path("m/44'/501'/0'/0'"),
message=b"Hello Solana!",
message=b"\x01\x00\x01\x02" + b"\x00" * 64,
))
self.assertIn("disabled by policy", str(exc.value))

def test_solana_sign_plain_text_message_without_advanced_mode(self):
"""Bounded printable login text signs without AdvancedMode."""
self.requires_firmware("7.15.0")
self.requires_fullFeature()
self.requires_message("SolanaSignMessage")
self.setup_mnemonic_allallall()
self.client.apply_policy('AdvancedMode', False)

text = (b"example.com wants you to sign in with your Solana account:\n"
b"Sign in to Example.\n\nNonce: 9d9972a1f2ed0aaa")
resp = self.client.call(messages.SolanaSignMessage(
address_n=parse_path("m/44'/501'/0'/0'"),
message=text,
))
self.assertEqual(len(resp.signature), 64)
self.assertEqual(len(resp.public_key), 32)

def test_solana_sign_empty_rejected(self):
"""Test that empty raw_tx is rejected."""
self.requires_fullFeature()
Expand Down