keepassxreboot / keepassxc-browser

KeePassXC Browser Extension
GNU General Public License v3.0
1.78k stars 188 forks source link

KeePass XC's Tor integration breaks torbrowser-launcher #2294

Closed Fabs37 closed 3 months ago

Fabs37 commented 3 months ago

Writing the .mozilla/native-messaging-hosts/org.keepassxc.keepassxc_browser.json file causes torbrowser-launcher to crash.

Current Behavior

Hey there, after I enabled Browser Integration and installed the browser extension (it did not work), I tried to restart Tor Browser, but it wouldn't launch. This is what I got:

$ torbrowser-launcher 
Tor Browser Launcher
By Micah Lee & Tor Project, licensed under MIT
version 0.3.7
https://gitlab.torproject.org/tpo/applications/torbrowser-launcher/
Traceback (most recent call last):
  File "/usr/bin/torbrowser-launcher", line 31, in <module>
    torbrowser_launcher.main()
  File "/usr/lib/python3.12/site-packages/torbrowser_launcher/__init__.py", line 81, in main
    common = Common(tor_browser_launcher_version)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/torbrowser_launcher/common.py", line 53, in __init__
    self.torbrowser12_rename_old_tbb()
  File "/usr/lib/python3.12/site-packages/torbrowser_launcher/common.py", line 176, in torbrowser12_rename_old_tbb
    os.rename(abs_filename, self.paths["tbb"]["dir_tbb"])
OSError: [Errno 39] Directory not empty: '/home/fab/.local/share/torbrowser/tbb/x86_64/tor-browser_en-US' -> '/home/fab/.local/share/torbrowser/tbb/x86_64/tor-browser'

Expected Behavior / Possible Solution

I moved ~/.local/share/torbrowser/tbb/x86_64/tor-browser_en-US/Browser/TorBrowser/Data/Browser/.mozilla/ to ~/.local/share/torbrowser/tbb/x86_64/tor-browser/Browser/TorBrowser/Data/Browser/ and then rm -rf-ed the tor-browser_en-US folder. After that, Tor and the extension worked flawlessly.

This leads me to the question: Why don't just write the .mozilla folder and its content to ~/.local/share/torbrowser/tbb/x86_64/tor-browser/...? Since it seems like the whole tor-browser_en-US folder has been created by KP and thus may be incorrect. Or is this rather a bug within torbrowser-launcher?

Debug info

KeePassXC - 2.7.9 KeePassXC-Browser - 1.9.1.1 Operating system: Linux (Fedora 40) Browser: Tor 13.5.1 (based on Mozilla Firefox 115.13.0esr) via torbrowser-launcher

droidmonkey commented 3 months ago

This is definitely not our bug. Nothing we do, especially merely writing config files for native messaging, should crash or impede browser operations. File a bug report with tor please.

Looks like they need to properly move files from the old folder structure to the new one and they aren't doing that.

droidmonkey commented 3 months ago

@varjolintu looks like Tor no longer uses the tbb subfolder

https://github.com/keepassxreboot/keepassxc/blob/develop/src%2Fbrowser%2FNativeMessageInstaller.cpp#L73

varjolintu commented 3 months ago

I cannot even install TorBrowser Launcher to Fedora 40, so I'm unable to test this properly.

alainwolf commented 3 months ago

It might have been introduced here: Rename old tor-browser folder with a locale, if it exists (7cbc6c9d) · Commits · The Tor Project / Applications / torbrowser-launcher · GitLab

alainwolf commented 3 months ago

This is definitely not our bug. Nothing we do, especially merely writing config files for native messaging, should crash or impede browser operations. File a bug report with tor please.

Looks like they need to properly move files from the old folder structure to the new one and they aren't doing that.

I might be wrong, but even if they did, the next time I start KeePassXC, with the Tor Browser Integration enabled, the problem would be there again as long as the KeePassXC code doesn't go along with their changes.

I wonder why I can't change that path in the GUI, at least on my installation, I am only able to customize the folder for either Firefox or Chromium, but not any of the other five supported browsers.

droidmonkey commented 3 months ago

Tor is Firefox, setup a custom browser to overcome the path issue

alainwolf commented 3 months ago

Tor is Firefox, setup a custom browser to overcome the path issue

Thanks @droidmonkey.

Looks like I misinterpreted the custom dialog. I assumed it would change the built-in configuration for Firefox or Chromium. Since I didn't want to loose browser integration for my standard Firefox, that wasn't an option. Instead it adds a new one, leaving the built-ins as they where.

So I got it working, but only after also adding the appropriate AppArmor rules.