fix(desktop): keep host seeds in the clear, and keep the ones we cannot read - #185
Merged
Merged
Conversation
…ot read The seed for each paired daemon went through Electron's safeStorage. On macOS that is the Keychain, which binds an item to the code signature that wrote it, and these builds are ad-hoc signed with a fresh identity every time. So an upgrade could not read the seeds the previous build had written: load() skipped every host that failed to decrypt, and the next persist() — a pair, a rename — rebuilt the file from memory and erased them. Installing a new DMG looked like the app had forgotten every host it had. The protection was not worth that. The seed authenticates to a daemon on loopback or a tailnet, next to a plaintext helios.db, and hosts.json is already 0600. So nothing is encrypted now, and an entry left over from the builds that did encrypt is carried through a write instead of being dropped — unreadable is not a reason to delete someone's host.
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.
What broke
Installing a new desktop build looked like the app had forgotten every host it was paired with.
Each host's device seed went through Electron's
safeStorage. On macOS that is the Keychain, and the Keychain binds an item to the code signature that wrote it.electron-builder.ymlsetsidentity: null, so every build is ad-hoc signed with a fresh identity — the new build could not read what the old one wrote.From there the loss was automatic:
load()skipped any host whose seed would not decrypt (if (!seed) continue).persist()rebuilds the file from what is in memory.hosts.jsonfor good.What changed
helios.db, andhosts.jsonis already0600— the Keychain was buying very little and cost real data.safeStorageis gone from the file.Anyone upgrading past this keeps their old entries in the file; a host that was encrypted still has to be paired again, because no key for it exists on the machine any more.
Test plan
desktop/e2e/hosts-store.spec.ts— seeds a readable host beside a legacyencrypted: trueone, renames through the Hosts pane to force a write, asserts the legacy entry survived and the readable one is written back with noencryptedflag. Fails onmain, passes here.npm test— 292 passnpx playwright test— 58 passnpm run typecheck