test: cover seedless temporary backup restores
What changed, and why it matters
This commit only adds a new automated test for the COLDCARD hardware wallet. It checks that a backup file can be restored as a temporary seed while the device is in a 'seedless' state. There is no change to the actual wallet firmware code, only to the test suite, so it does not introduce or fix a security vulnerability by itself.
No security action required. Treat as routine test-coverage commit. If reviewing a larger change set, verify that the underlying restore_backup and temporary-seed logic has separate test coverage and audit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds one test function, test_tmp_backup_restore_on_seedless(), to testing/seedless_tests.py. The test exercises the simulator through menu navigation, imports a 12-word temporary seed, attempts a backup restore via both the UI and the USB protocol (CCProtocolPacker.restore_backup with plaintext=True), and verifies the expected on-screen prompts appear. It is purely test coverage; no production code is modified.
Changed components
testing/seedless_tests.pyInspect captured patch +44 / −3
### testing/seedless_tests.py
@@ -1,11 +1,12 @@
# (c) Copyright 2024 by Coinkite Inc. This file is covered by license found in COPYING-CC.
#
-import pytest, pdb, time, random, os
+import pytest, pdb, time, random, os, shutil
from charcodes import KEY_CANCEL, KEY_QR
-from core_fixtures import _pick_menu_item, _press_select
+from core_fixtures import _pick_menu_item, _press_select, _press_cancel, _word_menu_entry
from core_fixtures import _need_keypress, _sim_exec, _cap_story
from run_sim_tests import ColdcardSimulator, clean_sim_data
from ckcc_protocol.client import ColdcardDevice
+from ckcc_protocol.protocol import CCProtocolPacker
def test_status_bar_rewrite_after_restore_master():
@@ -68,4 +69,44 @@ def test_seedless_qr_import_bad_checksum():
title, story = _cap_story(device)
assert 'checksum fail' in story
finally:
- sim.stop()
\ No newline at end of file
+ sim.stop()
+
+
+def test_tmp_backup_restore_on_seedless():
+ clean_sim_data()
+ backup = os.path.realpath('./data/ckcc-backup.txt')
+ shutil.copy(backup, os.path.realpath('../unix/work/MicroSD/ckcc-backup.txt'))
+
+ sim = ColdcardSimulator(args=["--q1", "-l"], headless=True)
+ sim.start(start_wait=3)
+ device = ColdcardDevice(is_simulator=True)
+ try:
+ _pick_menu_item(device, True, "Advanced/Tools")
+ _pick_menu_item(device, True, "Temporary Seed")
+ _need_keypress(device, "4")
+ _pick_menu_item(device, True, "Import Words")
+ _pick_menu_item(device, True, "12 Words")
+ _word_menu_entry(device, True, ["abandon"] * 11 + ["about"])
+ time.sleep(.5)
+ assert "New temporary master key is in effect now." in _cap_story(device)[1]
+ _press_select(device, True)
+
+ _pick_menu_item(device, True, "Advanced/Tools")
+ _pick_menu_item(device, True, "Danger Zone")
+ _pick_menu_item(device, True, "I Am Developer.")
+ _pick_menu_item(device, True, "Restore Bkup")
+ _pick_menu_item(device, True, "ckcc-backup.txt")
+ time.sleep(.2)
+ assert "load backup as temporary seed" in _cap_story(device)[1]
+ _press_cancel(device, True)
+ time.sleep(2.2)
+
+ with open(backup, "rb") as fd:
+ file_len, sha = device.upload_file(fd.read())
+ device.send_recv(CCProtocolPacker.restore_backup(file_len, sha, plaintext=True),
+ timeout=None)
+ time.sleep(.2)
+ assert "Restore uploaded backup as a temporary seed?" in _cap_story(device)[1]
+ _press_cancel(device, True)
+ finally:
+ sim.stop()Why this scored 12/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.