vrtmrz / obsidian-livesync

MIT License
3.92k stars 132 forks source link

generate_setupuri.ts is not using user-defined passphrase #426

Open pickaxe828 opened 1 month ago

pickaxe828 commented 1 month ago

Abstract

Passphrase unable to be set using the obsidian-livesync/main/utils/flyio/generate_setupuri.ts script. Instead, welcome is being used instead for the passphrase. Procedures from docs/setup_own_server.md

Expected behaviour

Actually happened

Reproducing procedure

  1. Follow docs/setup_own_server.md step 1 and 2
  2. Enter your own passphrase that's set by export passphrase=your_own_passphrase
  3. You can see Couldn't parse or decrypt configuration uri. in the log of LiveSync (Show log)
  4. Use the same URI, but enter "welcome" as passphrase into the LiveSync settings page
  5. You can connect sucessfully, meaning the passphrase is set to "welcome" instead of your own passphrase

Same problem

After I wrote this issue, I find this problem being mentioned in #350, with same finding in this comment

vrtmrz commented 1 month ago

Thank you for opening the issue! This is a designed behaviour, but it is indeed confusable.

The passphrase for Valut End-to-End Encryption is different from the passphrase for the configuration URI. This is to change the E2EE passphrase and CouchDB password in the event of unexpected exposure of the configuration URI or its passphrase.

Therefore, I have planned to use a volatile one instead of welcome at first. However, after a short thought, I changed my mind; this might confuse people more. Then I came up with a simple one, but I think we have a more confusable as a result. This is the current status.

Now I have two plans.

  1. Accept the environment variable setupuri_passphrase for the Setup URI. A. If not supplied, welcome is used. (Current behaviour). B. If not supplied, a random one will be used and displayed only once. (The original design).

I would love to hear your views on whether option A or B is preferable!

pickaxe828 commented 2 weeks ago

Tho the uri passphrase might not be as important, imho, it's always better to be secure. I think B is a better choice, as it is more secure than a same uri passphrase for everyone who didn't set a value for it. And B is actually quite intuitive for me 😆

vrtmrz commented 2 days ago

Thank you for your suggestion! I am so happy to implement it and make it better! Would you mind if I ask you to check the behaviour, please?