keepassxc-browser icon indicating copy to clipboard operation
keepassxc-browser copied to clipboard

Extension won't connect after Firefox update

Open simeonschaub opened this issue 2 years ago • 51 comments

After updating Firefox, the extension stopped working. I tried disconnecting the database in the extension settings, but if I then press "Connect" to reconnect again nothing happens. I also tried refreshing Firefox to clear the extension settings, but this also did not change things.

Debug info

KeePassXC - 2.7.4 KeePassXC-Browser - 1.8.3.1 Operating system: Linux x86_64 (Manjaro Linux 22.0.0) Browser: Mozilla Firefox 106.0

simeonschaub avatar Nov 17 '22 12:11 simeonschaub

Does Manjaro use Snap/Flatpak etc. for Firefox? Did the Troubleshooting Guide help? There's a few new sections concerning Linux (Firejail, socket location etc.).

varjolintu avatar Nov 17 '22 12:11 varjolintu

Looks like maybe Firefox changed their CSP? If I open the console when in the extension settings I see:

Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”).

Setting security.csp.enable to true temporarily as mentioned in https://stackoverflow.com/questions/37298608/content-security-policy-the-pages-settings-blocked-the-loading-of-a-resource seems to fix the issue.

I checked, the version of Firefox I am using is not based on Snap or Flatpak.

simeonschaub avatar Nov 17 '22 12:11 simeonschaub

Ah, maybe the next version fixes that then. There was some issue with an inline script.

varjolintu avatar Nov 17 '22 12:11 varjolintu

Hi, I'm also having the same behavior.

My config: KeePassXC - unknown (doesn't get detected probably because of the connection issue, but I have 2.7.4 installed) KeePassXC-Browser - 1.8.3.1 Operating system: Linux x86_64 (Ubuntu 22.04.1 LTS) Browser: Mozilla Firefox 107.0

I tried to reconnect the database from scratch by executing the KeePassXC-Browser Helper Script but it doesn't seem to change anything. Moreover, when I try to delete the existing database connection to reconfigure it, the delete button does not have any effect. When checking the console, I have the warning about CSP @simeonschaub mentioned, I also have this :

Uncaught TypeError: $(...) is null
    removeButtonClicked moz-extension://c01e1b50-74cf-4737-88fc-92a53e9aa84b/options/options.js:387
    removeButtonClicked moz-extension://c01e1b50-74cf-4737-88fc-92a53e9aa84b/options/options.js:387

I don't know if it this related to this issue, but it might...

alexisstgc avatar Nov 21 '22 10:11 alexisstgc

With Firefox 107

Cannot connect to KeePassXC. Check that browser integration is enabled in KeePassXC settings.

[Error keepass.js:270] KeePassXC-Browser - 5: Cannot connect to KeePassXC. Check that browser integration is enabled in KeePassXC settings.

If I click "🗘 Reload", it looks like it connects

KeePassXC-Browser: Connecting to native messaging host org.keepassxc.keepassxc_browser KeePassXC-Browser: Server public key: …

But it doesn't do anything and reopening the menu again shows the "Cannot connect" messages.

security.csp.enable makes no difference

Trying to do anything when it thinks it's connected results in

[Error client.js:175] KeePassXC-Browser - 8: KeePassXC association failed, try again

and maybe

[Error httpauth.js:42] KeePassXC-Browser - No logins found for HTTP Basic Auth.

undeference avatar Nov 27 '22 18:11 undeference

@undeference Details are missing e.g. about your OS and your findings from the Troubleshooting Guide.

varjolintu avatar Nov 28 '22 04:11 varjolintu

@undeference Details are missing e.g. about your OS and your findings from the Troubleshooting Guide.

Fedora release 37 (Thirty Seven) 6.0.9-300.fc37.x86_64 firefox-107.0-4.fc37.x86_64 keepassxc-2.7.4-2.fc37.x86_64

My findings are that parts of the troubleshooting guide are outdated (e.g., how to Inspect the extension and related menu items) and doesn't help with this issue.

undeference avatar Nov 28 '22 13:11 undeference

@undeference Is your Firefox and KeePassXC installed as Snap, Flatpak, or just as a normal binary via repositories?

varjolintu avatar Nov 28 '22 13:11 varjolintu

@undeference Is your Firefox and KeePassXC installed as Snap, Flatpak, or just as a normal binary via repositories?

These are normal binary packages from the official Fedora repositories. I did test with the official Firefox 107 release from mozilla.org and there was no difference.

undeference avatar Nov 28 '22 13:11 undeference

@undeference Is your Firefox and KeePassXC installed as Snap, Flatpak, or just as a normal binary via repositories?

These are normal binary packages from the official Fedora repositories. I did test with the official Firefox 107 release from mozilla.org and there was no difference.

And what did you find about the Native Messaging script locations, strace etc?

varjolintu avatar Nov 28 '22 14:11 varjolintu

And what did you find about the Native Messaging script locations, strace etc?

Paths are correct, as is extension ID. keepassxc-proxy is started. I'm not using firejail. I quoted from the developer console (after inspecting the content script from about:debugging).

Clicking the icon causes

write(4, "\1\0\0\0\0\0\0\0", 8)         = 8
write(6, "{\"action\":\"get-databasehash\",\"me"..., 307) = 307
write(4, "\1\0\0\0\0\0\0\0", 8)         = 8
poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN}], 2, -1) = 2 ([{fd=4, revents=POLLIN}, {fd=6, revents=POLLIN}])
read(4, "\2\0\0\0\0\0\0\0", 16)         = 8
ioctl(6, FIONREAD, [345])               = 0
read(6, "{\"action\":\"get-databasehash\",\"me"..., 345) = 345
write(1, "Y\1\0\0{\"action\":\"get-databasehash\""..., 349) = 349

"🗘 Reload" results in

write(4, "\1\0\0\0\0\0\0\0", 8)         = 8
close(6)                                = 0
futex(0x5615f6bdb400, FUTEX_WAKE_PRIVATE, 2147483647) = 1
futex(0x5615f6bdb3b0, FUTEX_WAKE_PRIVATE, 1) = 1
exit_group(0)                           = ?
+++ exited with 0 +++

and keepassxc-proxy restarts.

undeference avatar Nov 28 '22 14:11 undeference

@undeference What about the socket path? Have you enabled Firefox in the KeePassXC settings? This is the vital information I'm talking about :)

varjolintu avatar Nov 28 '22 14:11 varjolintu

@undeference What about the socket path? Have you enabled Firefox in the KeePassXC settings? This is the vital information I'm talking about :)

"Paths are correct" includes socket paths (including the symlink). Browser integration is enabled for Firefox.

undeference avatar Nov 28 '22 14:11 undeference

@undeference Does the keepassxc-proxy process stay up when you do the reload and it connects? Is the process up when you get the error again?

varjolintu avatar Nov 28 '22 14:11 varjolintu

@undeference Does the keepassxc-proxy process stay up when you do the reload and it connects? Is the process up when you get the error again?

No. When I press "🗘 Reload", keepassxc-proxy exits (with status 0). It is then restarted and it claims it's connected but it does not work. Opening the thing again shows the error again.

undeference avatar Nov 28 '22 14:11 undeference

@undeference Well that should definitely not exit. Have you tried another browser? I'd also suggest that you remove all connection from both KeePassXC and your browser and try to re-connect them.

varjolintu avatar Nov 28 '22 14:11 varjolintu

It works with Chrome 107.0.5304.121. I already tried removing all connections and reconnecting but it did not help.

undeference avatar Nov 28 '22 14:11 undeference

@undeference Then it must be something wrong with the Firefox version. That's all I can think of if everything should be just fine. Maybe downgrade to Firefox 106?

varjolintu avatar Nov 28 '22 16:11 varjolintu

It works with Firefox 105, 106, … and 107! If I create a new profile, it works fine. Reinstalling KeePassXC-Browser (which seems to clear its settings) does not fix it.

Any ideas for what to try?

undeference avatar Nov 28 '22 19:11 undeference

@undeference Maybe your profile is just corrupted? I've heard it happens.

varjolintu avatar Nov 28 '22 19:11 varjolintu

I just got done bisecting my prefs.js file and found the culprit: I had gfx.x11-egl.force-disabled set to true because of stability issues. Setting it to false fixes this. That seems like a definite Firefox bug.

undeference avatar Nov 28 '22 19:11 undeference

I saw something weird when I got to this step : https://github.com/keepassxreboot/keepassxc-browser/wiki/Troubleshooting-guide#3-check-if-keepassxc-proxy-is-launched-and-running

[pid 161801] openat(AT_FDCWD, "/home/username/snap/firefox/common/.mozilla/native-messaging-hosts/org.keepassxc.keepassxc_browser.json", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 160464] openat(AT_FDCWD, "/usr/lib/mozilla/native-messaging-hosts/org.keepassxc.keepassxc_browser.json", O_RDONLY <unfinished ...>

which is the wrong location.... i think the file it's looking for is:

/home/username/.mozilla/native-messaging-hosts/org.keepassxc.keepassxc_browser.json

Linux (Ubuntu 22.04 LTS) KeePassXC - Version 2.6.6 (Revision: 9c108b9) Firefox 103.0.1 (64-bit) (Mozilla Firefox Snap for Ubuntu)

mixmix avatar Nov 29 '22 09:11 mixmix

@mixmix That's a totally different issue. Run https://raw.githubusercontent.com/keepassxreboot/keepassxc/master/utils/keepassxc-snap-helper.sh

varjolintu avatar Nov 29 '22 13:11 varjolintu

Thanks for the pointer. I was using the Ubuntu package which I notice is behind a minor version. Shifted to snap

EDIT: Lol spoke too soon, browsers installed by snap are not supported.

mixmix avatar Dec 13 '22 20:12 mixmix

I've been having the same issue. I also use Free Download Manager, which uses NativeMessagingHosts as well, and it's not working, either.

What the add-on reports: KeePassXC-Browser has encountered an error: Cannot connect to KeePassXC. Check that browser integration is enabled in KeePassXC settings. (After clicking "Reload") Key exchange was not successful.

KeePassXC - unknown (it's 2.7.4) KeePassXC-Browser - 1.8.4 Operating system: Linux x86_64 (KDE Neon, User Ed., 5.26.5) Browser: Mozilla Firefox 109.0 (binary: org.kde.neon.net.launchpad.ppa.mozillateam -- no snap or flatpak)

org.keepassxc.keepassxc_browser.json:

{
    "allowed_extensions": [
        "[email protected]"
    ],
    "description": "KeePassXC integration with native messaging support",
    "name": "org.keepassxc.keepassxc_browser",
    "path": "/usr/bin/keepassxc-proxy",
    "type": "stdio"
}

$ sudo strace -f -p $(pgrep firefox) 2>&1 | grep keepass

[pid 93853] openat(AT_FDCWD, "/home/username/.mozilla/native-messaging-hosts/org.keepassxc.keepassxc_browser.json", O_RDONLY <unfinished ...>
[pid 83401] newfstatat(AT_FDCWD, "/usr/bin/keepassxc-proxy",  <unfinished ...>
[pid 83401] newfstatat(AT_FDCWD, "/usr/bin/keepassxc-proxy",  <unfinished ...>
[pid 83401] newfstatat(AT_FDCWD, "/usr/bin/keepassxc-proxy",  <unfinished ...>
[pid 83401] newfstatat(AT_FDCWD, "/usr/bin/keepassxc-proxy",  <unfinished ...>
[pid 83401] newfstatat(AT_FDCWD, "/usr/bin/keepassxc-proxy",  <unfinished ...>
[pid 94020] execve("/usr/bin/keepassxc-proxy", ["/usr/bin/keepassxc-proxy", "/home/username/.mozilla/native-messag"..., "[email protected]"], 0x7f13ec0a9a00 /* 78 vars */ <unfinished ...>
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\6\0\0\200\4\0\377\377sender\0\0,\0\0\200\4\0\377\377keepassx"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 4096
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\6\0\0\200\4\0\377\377sender\0\0,\0\0\200\4\0\377\377keepassx"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 4096
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="[email protected]"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 784
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] recvmsg(156, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] recvmsg(156, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] recvmsg(156, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236

$ ls -la /run/user/1000/org.keepassxc.KeePassXC.BrowserServer
lrwxrwxrwx 1 username username 80 Jan 11 09:11 /run/user/1000/org.keepassxc.KeePassXC.BrowserServer -> /run/user/1000/app/org.keepassxc.KeePassXC/org.keepassxc.KeePassXC.BrowserServer

lucknaumann avatar Jan 11 '23 22:01 lucknaumann

@lucknaumann Normally you'll have to restart your browser and the proxies after Firefox update. Make sure all of those are shutdown, including KeePassXC and restart them all.

varjolintu avatar Jan 12 '23 04:01 varjolintu

@varjolintu Yeah, I didn't want to open another issue as it happened weeks ago. FF and my computer have been restarted many times since. It just isn't working.

lucknaumann avatar Jan 12 '23 09:01 lucknaumann

@lucknaumann There's clearly something wrong with your browser installation if there's another extension using Native Messaging and it's not working either. You could always try to downgrade your browser, or try if the same happens with a different browser.

varjolintu avatar Jan 12 '23 13:01 varjolintu

@varjolintu Yeah, it works in Vivaldi, so it must be something relating to FF and Native Messaging. I'll look into reporting it to the FF people. Thanks for the quick replies! :smiley:

lucknaumann avatar Jan 12 '23 20:01 lucknaumann

FYI: I have got multiple reports from various people that that PPA version of Firefox just fails with Native Messaging. A manually installed version from a package works for some: https://support.mozilla.org/en-US/kb/install-firefox-linux#w_install-firefox-from-mozilla-builds-for-advanced-users

varjolintu avatar Jan 23 '23 18:01 varjolintu