Call for testing: native messaging support in the Firefox snap

I installed the Firefox beta, but it’s not working with KeePassXC 2.7.1 & keepassxc-browser 1.8.1 either. I get a message of “Error! Not connected to KeePassXC”.

1 Like

I’ve the same problem with the KeePassXC-Browser extension, it says that the key exchange failed. It never prompted for access, despite me copying the native messaging config file.

GNOME Shell worked OK after an “unexpected error” reported and a browser restart.

2 Likes

I can confirm that firefox needed a restart for the GNOME Shell extension to work.

This is related to Native Messaging indeed, but not fully addressed by this work yet. See the corresponding upstream bug report.

1 Like

Others in this thread have reported that Plasma integration works.
Can you run with:

MOZ_LOG=NativeMessagingPortal:5 snap run firefox

and share the output here?

1 Like

I just tested again the KeepassXC integration in a fully up-to-date 22.04 VM, and I was able to get it to work after following the official instructions for initial connection. In particular, it seems you need to make sure that the native application is running and the database is unlocked when requesting the initial connection from the browser (and you need to explicitly allow the browser extension from the app’s settings).

1 Like

You shouldn’t have needed to copy over any config file. Unless you’re using the KeepassXC snap, which cannot write the manifest to ~/.mozilla/native-messaging-hosts/ ?

Can you share the output of flatpak permissions webextensions ?

1 Like

Does this message help? Are you using KeepassXC installed as a deb or as a snap?

1 Like

Unfortunately, it still does not work here.

I now tested with a fresh Firefox profile and a fresh KeePassXC database, same result.
With MOZ_LOG=NativeMessagingPortal:5 set, the following output is printed:

[Parent 701511: Main Thread]: D/NativeMessagingPortal NativeMessagingPortal::NativeMessagingPortal()
[Parent 701511: Main Thread]: D/NativeMessagingPortal will be used
[Parent 701511: Main Thread]: D/NativeMessagingPortal NativeMessagingPortal::DelayedCall::DelayedCall()
[Parent 701511: Main Thread]: D/NativeMessagingPortal D-Bus proxy ready for name org.freedesktop.portal.Desktop, path /org/freedesktop/portal/desktop, interface org.freedesktop.portal.WebExtensions
[Parent 701511: Main Thread]: D/NativeMessagingPortal is available
[Parent 701511: Main Thread]: D/NativeMessagingPortal NativeMessagingPortal::DelayedCall::~DelayedCall()
[Parent 701511: Main Thread]: D/NativeMessagingPortal creating session with handle suffix firefox_org_keepassxc_keepassxc_browser_2915241622
[Parent 701511: Main Thread]: D/NativeMessagingPortal session created with handle /org/freedesktop/portal/desktop/session/1_2232/firefox_org_keepassxc_keepassxc_browser_2915241622
[Parent 701511: Main Thread]: D/NativeMessagingPortal starting org.keepassxc.keepassxc_browser, requested by keepassxc-browser@keepassxc.org in session /org/freedesktop/portal/desktop/session/1_2232/firefox_org_keepassxc_keepassxc_browser_2915241622
[Parent 701511: Main Thread]: D/NativeMessagingPortal native application start requested in session /org/freedesktop/portal/desktop/session/1_2232/firefox_org_keepassxc_keepassxc_browser_2915241622, pending response for /org/freedesktop/portal/desktop/request/1_2232/firefox/1661947729
[Parent 701511: Main Thread]: D/NativeMessagingPortal got response signal for /org/freedesktop/portal/desktop/request/1_2232/firefox/1661947729 in session /org/freedesktop/portal/desktop/session/1_2232/firefox_org_keepassxc_keepassxc_browser_2915241622
[Parent 701511: Main Thread]: D/NativeMessagingPortal native application start canceled by user in session /org/freedesktop/portal/desktop/session/1_2232/firefox_org_keepassxc_keepassxc_browser_2915241622
[Parent 701511: Main Thread]: D/NativeMessagingPortal session /org/freedesktop/portal/desktop/session/1_2232/firefox_org_keepassxc_keepassxc_browser_2915241622 was closed by the portal
[Parent 701511: Main Thread]: D/NativeMessagingPortal cannot close session /org/freedesktop/portal/desktop/session/1_2232/firefox_org_keepassxc_keepassxc_browser_2915241622, unknown handle

I also made sure that I stopped my regular Firefox before starting the snap Firefox. KeePassXC was running and unlocked before starting Firefox. Browser integration is enabled in KeePassXC (after all, it works fine with my regular Firefox).

Any idea what else I could try? Can I provide more helpful information somehow?

Can you share the output of flatpak permissions webextensions ?

1 Like

Sure:

Table         Object                          App          Permissions Data
webextensions org.keepassxc.keepassxc_browser snap.firefox no          0x00
webextensions org.gnome.chrome_gnome_shell    snap.firefox yes         0x00

It seems the no in the Permissions column is likely a problem, right? How can I change that?

Yes indeed. Try:

flatpak permission-set webextensions org.keepassxc.keepassxc_browser snap.firefox yes
2 Likes

Thanks, now it works fine!

3 Likes

Turns out I was missing flatpak permissions just like the everyone else xD Both extensions are working great now, thanks for the help! I would still be happy to post that output if you’d like it.

(Not really on-topic but I didn’t even know that flatpak was on my system, let alone that it was running those permissions. I just got my head around the differences between snap and apt-get xD)

I am using the KeepassXC snap, yes. Did I mis-assume that this (inter-snap native communication) was supported now? I thought that was the main benefit, as you could have used it all along if either side was not a snap?

Oh yeah, and having installed flatpak, I can’t see KeepassXC in there at all:

$ LANG=C flatpak permissions webextensions
Table         Object                       App          Permissions Data
webextensions org.gnome.chrome_gnome_shell snap.firefox yes         0x00
1 Like

In fact flatpak is not the owner of these permissions, xdg-desktop-portal is. But the flatpak command-line tool is a convenient way to inspect and change them. I guess it would be less confusing if it was an external tool, e.g. something called “xdg-desktop-portal-permissions”.

5 Likes

No, the expectation is correct. The intention is to make it work for both browsers and native host connectors as snaps. In the case of KeepassXC I had to jump through a few hoops to make it work, but I did manage to make it work:

  • make sure the application is running and unlocked
  • make sure the browsers integration checkbox is ticked in the app’s settings
  • download and run the KeePassXC-Browser Helper Script, but tell it that firefox is not installed as a snap, otherwise it will bail out
  • verify that the script installed a manifest for the keepassxc proxy in ~/.mozilla/native-messaging-hosts/, pointing to /snap/bin/keepassxc.proxy
  • restart firefox
3 Likes

Another successful test:

Ubuntu 22.04
FF snap (beta)
KeepassXC snap

Did have to manually install the flatpak with apt, since it was not installed.

Your remark regarding the fact that flatpak was not the owner of the permissions gave the final push :smile:

I just tested the ff2mpv extension and I can confirm that it works as expected. This is in an up-to-date Ubuntu 22.04 VM, with firefox from the beta channel.

1 Like

Ah! So I went ahead of myself and moved the file into ~/snap/, which was the wrong step. Now I’ve moved it back it’s working fine, thanks!

2 Likes