quexten / bw-bio-handler

Bitwarden desktop browser biometrics, without the desktop app, on linux
MIT License
14 stars 0 forks source link

Not working for browsers installed as Flatpak or Snap #6

Open Sebiee opened 1 year ago

Sebiee commented 1 year ago

Tried both manual & auto install. When I enable unlock with biometrics in the extension, it first locks itself and then, after I unlock with my master password, it says that the browser integration is not setup. image

Btw, for chromium the manifest json that gets copied inside NativeMessaging is wrong. There's a typo in main.go#132, it shuld be templateChrome instead of templateMozilla. Also, I needed to update that depth of 3 since I installed chromium via snap and the path had more than 3 /.

Do you have any idea?

quexten commented 1 year ago

Hi, thank you for your report and pointing out a bug in the code! I have fixed the template bug for now but still have to test with chrome.

However, since you mention installing via snap: Snaps (and Flatpaks) sandbox the native messaging (which the official desktop client also uses to communicate with the browser extension). If either the desktop client or the browser is installed as a snap, this makes native messaging impossible to do in the default way as far as I understand. The easiest way to fix this would be to use chrome as a non-sandboxed package (rpm/deb/etc.).

These are the chromium and firefox bugs: https://bugs.launchpad.net/ubuntu/+source/chromium-browser/+bug/1741074 https://bugzilla.mozilla.org/show_bug.cgi?id=1661935

The proper fix is to use the WebExtensions portal with something like:

sudo apt-get install flatpak
flatpak permission-set webextensions org.kde.plasma.browser_integration snap.firefox yes
restart firefox

which should permit the IPC. I have not yet had time to test this with this tool / to integrate it into the setup.

quexten commented 1 year ago

Okay, I have tested chromium and google-chrome installed as RPMs, and they work fine after changing the template.

As far as I can tell, Snap and Flatpak versions of chrome/chromium will only work if the WebExtensions portal is finished (Related Pull Request: https://github.com/flatpak/xdg-desktop-portal/issues/655 ). Ubuntu Firefox has support for this, but as far as I can tell there is no support for Flatpak yet. Chromium has no support as of now for either as far as I can tell. Until the portal is finished and the browsers support it, there is nothing I can do to fix this. This also applies to the official Bitwarden Desktop App.

So the only short term fix for you is to install chromium as a deb/rpm/AppImage.

I'm leaving this issue open for tracking until the WebExtensions portal support is finished and I tested it with this tool.