Skip to content

fix: support current Termius IndexedDB schema and blank-secret decryption - #1

Open
roman-dubovik wants to merge 1 commit into
ZeroP27:mainfrom
roman-dubovik:fix/current-termius-schema
Open

fix: support current Termius IndexedDB schema and blank-secret decryption#1
roman-dubovik wants to merge 1 commit into
ZeroP27:mainfrom
roman-dubovik:fix/current-termius-schema

Conversation

@roman-dubovik

Copy link
Copy Markdown

Problem

termius-local-export produced hostCount: 0 against current Termius
desktop builds (tested on Termius 9.38.2), even though the IndexedDB
dump clearly contained hosts. Two independent root causes:

  1. Obsolete entity layout. collectEntities only recognised
    entities tagged with an entityName field and 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 } references. Nothing matched entityName, so every
    host was dropped.

  2. Blank secrets treated as decryption failures. tryDecryptString
    used if (!decrypted), which treats a ciphertext that authenticates
    to 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 valid
    decrypted value.

Changes

  • lib/format.js: add store-based entity collection that resolves
    hosts → ssh_configs → ssh_identities → keys plus groups by
    id/local_id. The legacy entityName layout is kept as a fallback,
    so older dumps still work.
  • lib/decrypt-child.cjs: distinguish "" (valid empty plaintext) from
    null (decryption failure) in tryDecryptString.
  • test/format.test.js: add a store-layout test covering id/local_id
    linking and a blank-password key-auth host.

Verification

  • npm test → 13/13 pass.
  • Real export (Termius 9.38.2): 35 hosts, 24 passwords, 20 keys. The
    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)

--launch only works when Termius is fully quit beforehand. Electron's
single-instance lock makes a second launch reactivate the running
instance and ignore --remote-debugging-port, so DevTools never opens
and the tool times out. Might be worth a README mention.

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant