Repository navigation
fix(restore): warn when the restored words belong to an address the relay has never seen - #42
Merged
Merged
Conversation
…elay has never seen The twelve words carry only a 4-bit BIP39 checksum, so about one in sixteen swaps of a word for another list word passes and silently creates a different, empty identity (security assessment 2026-11-23, SEC-H2). A stronger checksum would break every existing phrase. What can be said without breaking anything: an identity that was ever used has a device at the relay. After a restore, if the relay answers 404 on the first device query, the chat list shows a hint with "Enter the words again" (wipes the empty identity and opens the restore screen) and "The words are right" (identities unused for a long time or on another relay). The marker lives in the database meta, so it survives a restart before the first connect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…merge conflict Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged
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.


Addresses SEC-H2 from the external security assessment of 16–23 Nov 2026: "about 1 in 15 mistyped phrases silently creates a different identity".
Confirmed
Bip39.validatechecks 12 words = 128 bit entropy + 4 bit checksum, so a word swapped for another word of the list passes about one time in sixteen. After that,restoreIdentityopens a new database, and on the first connect_mitRelayMitGeraetensilently creates an epoch-1 device list for the unknown address. The user lands in an empty chat list of a stranger's identity, and nobody can reach them there.Fix (without breaking existing phrases)
A stronger checksum would invalidate every phrase that exists today, so that is left as a decision. What can be said without breaking anything: an identity that was ever used has a device at the relay.
restoreIdentitymarks the database (meta wiederherstellung_offen), so it also survives a restart before the first connect._ermittleGeraetId: if the first device query answers 404 after a restore, it setswiederherstellung_unbekannt.A normal new identity, and a restore of a used identity, never show the hint.
Tests
test/net/wiederherstellen_unbekannt_test.dart(real relay):Run in CT 107:
flutter analyzeshows only the 29 existing hints; the new test pluswiederherstellen_test,geraeteabmeldung_test,zwei_geraete_test,geraeteliste_stufe2_testand all oftest/oberflaeche: 219 green.Open (decision)
🤖 Generated with Claude Code