You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR #582 adds a single last_completed_coded_word[12] and overwrites it every time a word is completed. That repairs one backspace across the immediately preceding boundary, but it cannot restore raw host bytes after the user backs up across two or more completed words.
Concrete sequence after entering two words and the following space:
State is decoded mnemonic word1 word2 ; last_completed_coded_word contains only word2 raw bytes.
Delete the trailing space: coded_word is correctly restored to word2.
Delete every character of word2: coded_word becomes empty and mnemonic ends in the space after word1.
Delete that space: plaintext decoded_word now points at word1, but the code again copies last_completed_coded_word, which still contains word2 raw bytes.
The PR adds no targeted recovery/backspace regression tests, so its reported 494/499 existing-suite result does not exercise this state transition.
Required fix
Preserve raw coded history for every editable word (or maintain a separate raw-coded mnemonic/history stack), not only the most recently completed word. Add regressions that backspace:
within the current word;
across one word boundary;
across two and 23 word boundaries;
then re-enter a direct unciphered BIP39 prefix and prove the bypass detector still fires;
through repeated delete/retype cycles while checking words_entered, decoded mnemonic, and raw coded history remain aligned.
Residual defect in the proposed #581 fix
PR #582 adds a single
last_completed_coded_word[12]and overwrites it every time a word is completed. That repairs one backspace across the immediately preceding boundary, but it cannot restore raw host bytes after the user backs up across two or more completed words.Concrete sequence after entering two words and the following space:
word1 word2;last_completed_coded_wordcontains only word2 raw bytes.coded_wordis correctly restored to word2.coded_wordbecomes empty and mnemonic ends in the space after word1.decoded_wordnow points at word1, but the code again copieslast_completed_coded_word, which still contains word2 raw bytes.coded_wordreaches four bytes,attempt_auto_complete(coded_word)evaluates a synthetic word2/word1 mixture rather than the literal host bytes, recreating the substitution-cipher-bypass detector gap recovery_cipher.c: backspace-before-4th-character defeats the substitution-cipher-bypass detector, because the per-position cipher used to reconstruct coded_word isn't preserved #581 was meant to close.The PR adds no targeted recovery/backspace regression tests, so its reported 494/499 existing-suite result does not exercise this state transition.
Required fix
Preserve raw coded history for every editable word (or maintain a separate raw-coded mnemonic/history stack), not only the most recently completed word. Add regressions that backspace:
words_entered, decoded mnemonic, and raw coded history remain aligned.Related: #581 and PR #582.