Skip to content
Merged
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
531 changes: 515 additions & 16 deletions scripts/generate-test-report.py

Large diffs are not rendered by default.

650 changes: 650 additions & 0 deletions tests/test_msg_bitcoin_only_variant.py

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions tests/test_msg_ethereum_clear_signing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,8 @@ def test_advanced_mode_gate(self):
to=AAVE_V3_POOL, value=0, data=data, chain_id=1)
self.fail("Expected Failure — blind signing disabled")
except CallException as e:
self.assertIn("Blind signing disabled", str(e))
self.assertIn("Arbitrary contract data signing disabled by policy",
str(e))

# ON → raw-data confirm path → signs
self.client.apply_policy("AdvancedMode", 1)
Expand Down Expand Up @@ -1156,7 +1157,8 @@ def test_cancel_clears_metadata_not_reused(self):
to=AAVE_V3_POOL, value=0, data=data, chain_id=chain_id)
self.fail("Expected Failure — stale metadata must not be reused")
except CallException as e:
self.assertIn("Blind signing disabled", str(e))
self.assertIn("Arbitrary contract data signing disabled by policy",
str(e))


# ── LoadClearsignSigner — the phase-1 trust path ───────────────────
Expand Down
363 changes: 363 additions & 0 deletions tests/test_msg_ethereum_clearsign_additive.py

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions tests/test_msg_ethereum_signtx.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ def test_ethereum_signtx_data(self):
def test_ethereum_blind_sign_blocked(self):
"""AdvancedMode OFF + contract data = device refuses to sign (7.15+).

OLED shows 'Blind signing disabled' then Failure.
OLED shows the blind-sign refusal, then Failure. The wire message is
7.14.2's "Arbitrary contract data signing disabled by policy", which
replaced alpha's shorter "Blind signing disabled" -- it names WHICH
policy refused and what it refused.
"""
self.requires_firmware("7.15.0")
self.requires_fullFeature()
Expand All @@ -121,7 +124,8 @@ def test_ethereum_blind_sign_blocked(self):
)
self.fail("Expected Failure -- blind signing should be blocked")
except CallException as e:
self.assertIn("Blind signing disabled", str(e))
self.assertIn("Arbitrary contract data signing disabled by policy",
str(e))

def test_ethereum_blind_sign_allowed(self):
"""AdvancedMode ON + contract data = device shows BLIND SIGNATURE warning (7.15+).
Expand Down
26 changes: 19 additions & 7 deletions tests/test_msg_resetdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,20 @@ def test_reset_device_dice(self):
self.assertEqual(' '.join(mnemonic), expected_mnemonic)

def test_reset_reentry_disarms_entropy_ack(self):
"""An aborted reset must not leave EntropyAck armed.
"""An abandoned reset must never leave EntropyAck armed.

Regression: reset_init aborts (dice cancel, PIN mismatch, ...) left
awaiting_entropy set from an earlier run while zeroing int_entropy,
so a following EntropyAck derived the seed from
Regression this guards: reset_init aborts (dice cancel, PIN mismatch,
...) left awaiting_entropy set from an earlier run while zeroing
int_entropy, so a following EntropyAck derived the seed from
sha256(0*32 || host_bytes) -- entirely host-chosen.

7.15 closes it EARLIER and more strongly than the original fix did.
#429 replaced the separate awaiting_entropy flag with a single armed
(kind) ceremony, and setup_stage() now REFUSES to open a second
ceremony on top of an armed one. So the re-entry this test used to
perform is rejected outright rather than being allowed and then
disarmed -- there is no second ceremony to leave armed. Both halves are
asserted below: the refusal, and then the original property.
"""
self.requires_firmware("7.15.0")
self.client.wipe_device()
Expand All @@ -212,16 +220,20 @@ def test_reset_reentry_disarms_entropy_ack(self):
label='first'))
self.assertIsInstance(ret, proto.EntropyRequest)

# Re-enter with dice, then abort from the host.
# Re-entry is REFUSED while a ceremony is armed. This is the #429
# guard; before it, the second ResetDevice was accepted and the code
# had to remember to disarm the first one.
ret = self.client.call_raw(proto.ResetDevice(display_random=False,
strength=256,
passphrase_protection=False,
pin_protection=False,
language='english',
label='second',
dice_entropy=True))
self.assertIsInstance(ret, proto.ButtonRequest)
self.assertEqual(ret.code, proto_types.ButtonRequest_DiceRoll)
self.assertIsInstance(ret, proto.Failure)
self.assertIn('middle of setup', ret.message)

# Abandon the FIRST ceremony the way the host is told to.
ret = self.client.call_raw(proto.Cancel())
self.assertIsInstance(ret, proto.Failure)

Expand Down
Loading
Loading