An E2EE passphrase beginning with '%' is saved unencrypted and discarded on the next start-up
Required
Abstract
If the end-to-end encryption passphrase begins with %, it is written to data.json without being encrypted. On the next start-up it cannot be decrypted, so it is replaced with an empty string, and synchronisation refuses to start.
Expected behaviour
Any passphrase is saved in encrypted form and survives a restart. Alternatively, a passphrase that cannot be stored is rejected when it is entered.
Actually happened
Synchronisation works in the session where the passphrase is set. After Obsidian is restarted, the log shows:
Failed to decrypt configuration item
Failed to decrypt passphrase from data.json! Ensure configuration is correct before syncing with remote.Replication is then refused with 'Empty passphrases cannot be used without explicit permission'. Running the E2EE wizard again sets the passphrase, and it is lost again on the next restart. Changing to a passphrase that does not begin with % fixed the problem, and it has survived restarts since.
Reproducing procedure
- Enable end-to-end encryption with a passphrase that begins with
%, for example%example. - Complete the set-up. Synchronisation works.
- Restart Obsidian.
- The passphrase is empty, the errors above are logged, and synchronisation does not start.
I observed this once, with my real passphrase. The minimal procedure above follows from the code path described below. I have not run it separately with a throwaway passphrase.
Cause
In livesync-commonlib, src/encryption/stringEncryption.ts, encryptString() returns its input unchanged if it begins with ENCRYPT_V2_PREFIX ('%') or HKDF_SALTED_ENCRYPTED_PREFIX ('%$'), on the assumption that it is already encrypted.
SettingService.encryptConfigurationItem() passes the plain passphrase to encryptString(). A passphrase beginning with % is therefore stored in encryptedPassphrase as plain text. On load, decryptConfigurationItem() sees the % prefix, decryptString() tries to decrypt it as V2 or V3 ciphertext, all attempts fail, and the passphrase is set to ''.
A side effect is that the passphrase is stored in plain text in data.json, not in encrypted form.
One possible fix is for encryptConfigurationItem() to always encrypt, without the 'already encrypted' short-circuit, because its input is always plain text. Another is to reject or warn about a leading % in the passphrase field.
Obsidian debug info
Device 1 (primary, desktop)SYSTEM INFO:
Obsidian version: 1.13.7
Installer version: 1.13.7
Operating system: #1 SMP PREEMPT_DYNAMIC Mon, 21 Sep 2026 18:51:14 +0000 7.2.7-arch1-1
Login status: not logged in
Language: en
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: off
Plugins installed: 1
Plugins enabled: 1
1: Self-hosted LiveSync v1.0.32LiveSync version
- Self-hosted LiveSync version: 1.0.32 (the latest release). The
encryptString()code described above is unchanged on themainbranch oflivesync-commonlib.
Report and Logs from LiveSync
I have not attached the full report, because the problem happens while data.json is being loaded, before any synchronisation, and the report would contain nothing beyond the two log lines above. I can provide a redacted report if it would help.
Optional
Other information, insights and intuition
This is not the same as #1146. The passphrase itself is lost, not the E2EE setting.
Posted by an AI agent on behalf of @circuskid.
Source: vrtmrz/obsidian-livesync