Repository navigation
Conversation
kkdao
force-pushed
the
fix/inactivity-wipe
branch
from
September 21, 2026 08:24
c1c50c6 to
2b6a0d0
Compare
kkdao
marked this pull request as draft
September 21, 2026 17:29
The inactivity wipe zeroed stored seeds, but other secrets outlived it. The inherited Seed.wipe() clears _mnemonic, which Slip39Seed and XprvSeed never defined. It raised AttributeError after the subclass fields were zeroed, and the exception escaped clear_pending_seed() and aborted handle_wipe_timeout(): nothing after it was cleared and no toast was shown. XprvSeed.wipe() dropped the HDKey parsed from the xprv without zeroing its key and chain code. The words of a half-finished seed entry live in SeedStorage rather than in a Seed, so nothing cleared them. psbt_seed can hold a WIFKey, which never enters storage.seeds and had no wipe(). The psbt parser keeps a root key of its own, and can hold a WIF key that psbt_seed has already dropped. The timer never touched the GlobalPlatform card keys. The password-generator entropy, the card PINs, the Satodime unlock secrets, the OpenPGP admin PIN and the EncryptedQR key were only dereferenced. Zero each of these where it is held, and make clear_pending_seed() best-effort as discard_seed() already is. Each zeroing step runs on its own, so one failure cannot skip the others. wipe_dict() zeroes only the values named as secret. Next to them sit type tags and source names that are code constants, and on CPython before 3.12, which the device runs, a constant is not immortal: zeroing one in place breaks the key file parser and every comparison with the constant until reboot.
WipeTimerThread is the only thing that runs the inactivity wipe, and nothing caught an exception inside it. One failure in handle_wipe_timeout(), such as the AttributeError a pending Slip39Seed or XprvSeed used to raise, ended the thread: that wipe stopped part way, no toast was shown, and no later timeout wiped anything for the rest of the session. Log the error and keep the thread running. The inactivity clock restarts after a failed wipe, so the wipe is retried after the next full interval rather than every second.
A WIF or BIP38 key signs a psbt without entering SeedStorage, so the inactivity wipe reaches it only while psbt_seed or the psbt parser still holds it. Home ends the psbt flow and drops both references: on the ordinary route, sign and then go Home, the private key was freed unzeroed long before any timeout, and the later wipe still reported the data as wiped. Zero a WIF key held by psbt_seed or by the parser before Home drops them. A stored seed is left alone: it outlives the flow, and an XprvSeed shares its root key with the parser.
wipe_string() refuses a string the interpreter shares, but wipe_bytes() zeroed any bytes object it was given. CPython keeps one object for each one-byte value, so wiping a one-byte secret turned that value into NUL everywhere else in the process, on every version. One-character strings are cached the same way, and before 3.11 their refcount is too low for the shared-string check to notice. Treat one-byte and one-character objects as shared, and give wipe_bytes() the same guard as wipe_string().
The inactivity wipe leaves a Destination for the main menu on the back stack, for the main loop to run next. A Destination has no view until it has run, and the check for whether the screensaver may start read the view of the top one, so the first check after a wipe raised AttributeError and the device showed a System Error. Every device with the Wipe Timer on hit it the first time the timer fired. A Destination that has not run yet counts as the main menu, as an empty back stack already did.
kkdao
force-pushed
the
fix/inactivity-wipe
branch
from
September 22, 2026 09:19
2b6a0d0 to
4f66509
Compare
6 of 18 tasks
kkdao
marked this pull request as ready for review
September 22, 2026 09:20
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem or Issue being addressed
The inactivity wipe told the user their data was wiped while secrets survived it:
Slip39Seed/XprvSeedwipe()raised, which aborted the rest of the wipe; an xprv seed's root key was never zeroed.psbt_seed, the JavaCard GlobalPlatform keys, card PINs and Satodime unlock secrets, the EncryptedQR key and the password-generator entropy were not wiped at all.Solution
Five commits:
fix: wipe the secrets the inactivity timer misses— every step runs on its own;wipe_dict()zeroes only the named secret fields, so type tags likesinglesurvive.fix: keep the wipe timer running after an errorfix: zero the WIF signing key when going Homefix: never zero a bytes object CPython shares— one-bytebytesare interned; zeroing one corrupted it for the whole process.fix: let the screensaver start after a wipe— the wipe leaves an unrun main-menu Destination on the back stack, and the screensaver check read its missingview: every device with the Wipe Timer on showed a System Error after the first wipe (found on the Pi Zero test below; the check is ondevtoo).Additional Information
Not fixed here: a WIF key dropped mid-flow is freed without being zeroed (the natural place is #451's
psbt_seedsetter once it lands); BIP85 GPG keys stay in the gpg keyring; camera entropy frames are only dereferenced.Screenshots
N/A — no screen change.
This pull request is categorized as a:
Checklist
I ran
pytestlocallyCI on the fork (Linux 3.10/3.12 and the Linux/macOS desktop matrix, screenshots included) is green on this exact code. The Windows desktop lanes were left out: they fail on
devitself ("runner lost communication").I included screenshots of any new or modified screens
I added or updated tests
I tested this PR hands-on on the following platform(s):
Pi Zero, SeedSigner OS built from this branch merged with #449–#451: Wipe Timer set to 5 minutes, left idle, the wipe ran and returned to the main screen; the next use hit the screensaver
AttributeErrorthat commit 5 fixes. Commit 5 is in-memory controller state only, reproduced exactly by its unit test, so it was not re-flashed.I have reviewed these notes: