fix: support current Termius IndexedDB schema and blank-secret decryption - #1
Open
roman-dubovik wants to merge 1 commit into
Open
fix: support current Termius IndexedDB schema and blank-secret decryption#1roman-dubovik wants to merge 1 commit into
roman-dubovik wants to merge 1 commit into
Conversation
…tion
The exporter returned hostCount: 0 against current Termius desktop builds
(tested on 9.38.2). Two independent root causes:
1. Obsolete entity layout. collectEntities only recognised entities tagged
with an entityName field nested inline. Current Termius stores each
entity type in its own IndexedDB store (hosts, ssh_configs,
ssh_identities, keys, groups) and links them by { id, local_id }, so
nothing matched and every host was dropped. Add store-based collection
that resolves hosts -> ssh_configs -> ssh_identities -> keys plus groups,
keeping the entityName layout as a fallback.
2. Blank secrets treated as decryption failures. tryDecryptString used
if (!decrypted), treating a ciphertext that authenticates to an empty
string (a blank password on a key-auth host) the same as a real failure
and emitting the raw encrypted blob. Only null is a genuine failure;
distinguish it from a valid empty result.
Add a store-layout test covering id/local_id linking and a blank-password
key-auth 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.
Problem
termius-local-exportproducedhostCount: 0against current Termiusdesktop builds (tested on Termius 9.38.2), even though the IndexedDB
dump clearly contained hosts. Two independent root causes:
Obsolete entity layout.
collectEntitiesonly recognisedentities tagged with an
entityNamefield and nested inline. CurrentTermius stores each entity type in its own IndexedDB store (
hosts,ssh_configs,ssh_identities,keys,groups) and links them by{ id, local_id }references. Nothing matchedentityName, so everyhost was dropped.
Blank secrets treated as decryption failures.
tryDecryptStringused
if (!decrypted), which treats a ciphertext that authenticatesto an empty string (a blank password on a key-auth host) the same as
a real failure, and fell back to emitting the raw encrypted blob.
Only
null(auth-tag failure) is a genuine failure;""is a validdecrypted value.
Changes
lib/format.js: add store-based entity collection that resolveshosts → ssh_configs → ssh_identities → keysplus groups byid/local_id. The legacyentityNamelayout is kept as a fallback,so older dumps still work.
lib/decrypt-child.cjs: distinguish""(valid empty plaintext) fromnull(decryption failure) intryDecryptString.test/format.test.js: add a store-layout test coveringid/local_idlinking and a blank-password key-auth host.
Verification
npm test→ 13/13 pass.previously garbled identity passwords now decrypt to empty (they are
key-auth hosts with no password), and hosts whose label is a
blank-encrypted value fall back to their address for the SSH alias.
Note (not changed here)
--launchonly works when Termius is fully quit beforehand. Electron'ssingle-instance lock makes a second launch reactivate the running
instance and ignore
--remote-debugging-port, so DevTools never opensand the tool times out. Might be worth a README mention.