Nixpkgs: browserpass does not taltk to firefox 57

Created on 11 Jan 2018  路  16Comments  路  Source: NixOS/nixpkgs

Issue description

With firefox-57, browserpass does not work properly. When clicking on the browserpass icon in firefox, browserpass states 'Error talking to browserpass'

Steps to reproduce

  • Install browserpass via programs.browserpass.enable = true
  • Install firefox via environment.systemPackages = with pkgs; [ firefox ]
  • Install browserpass browserplugin via firefox marketplace
  • Click on browserpass icon in firefox

Technical details

  • system: "x86_64-linux"
  • host os: Linux 4.14.9, NixOS, 17.09.2498.a9ffb7b0b5a (Hummingbird)
  • multi-user?: yes
  • sandbox: no
  • version: nix-env (Nix) 1.11.16
  • channels(root): "nixos-17.09.2498.a9ffb7b0b5a"
  • channels(wucke13): "nixpkgs-18.03pre121983.fd7953d95f4"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs

Most helpful comment

This was fixed in #31743 by a Nixpkgs option. Maybe programs.browserpass.enable should set the correct Nixpkgs option by default{

All 16 comments

~Unfortunately I think this is unfixable at the moment~ (the issue is patched around in nixpkgs build of firefox). Firefox expects native messaging manifests to be found in /usr/{lib,lib64}/mozilla/native-messaging-hosts/ (Chrome uses /etc/). This means there's no way to expose manifest files on NixOS on the system level.

You can work around it by linking the firefox manifest from browserpass into ~/.mozilla/native-messaging-hosts/com.dannyvankooten.browserpass.json. Something like this should do it:

mkdir -p ~/.mozilla/native-messaging-hosts/
ln -s $(nix-build '<nixpkgs>' -A browserpass)/lib/mozilla/native-messaging-hosts/com.dannyvankooten.browserpass.json ~/.mozilla/native-messaging-hosts/

Relevant Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1318461

This was fixed in #31743 by a Nixpkgs option. Maybe programs.browserpass.enable should set the correct Nixpkgs option by default{

I never managed to make it work either so thanks @ttuegel for the pointer. I believe home-manager installs it in ~/.mozilla so that could work too.

So this is fixable, the fix was not straightforward but it is going to be fixed in 18.03?

Yeah, disregard my comment above (nixpkgs patch around the firefox issue).

If I understand correctly you want to do something like this in configuration.nix to make browserpass work now:

 nixpkgs.config.firefox.enableBrowserPass = true;

I'm experiencing this same issue with firefox 59.0.1.

I have tried both firefox-bin and firefox. I'm mostly using firefox-bin because I like the Mozilla branding, but it doesn't matter that much really.

I have added programs.browserpass.enable = true; in my configuration. I've used browserpass in firefox a long time ago (before 57 I believe) using home-manager and still have programs.browserpass.enable = true; set in home-manager which successfully creates the symlink in .mozilla/native-messaging-hosts/com.dannyvankooten.browserpass.json.

I've just started google-chrome up to test there and that seems to work. But that won't help me that much in firefox :smile:

output from nix-info:
system: "x86_64-linux", multi-user?: yes, version: nix-env (Nix) 2.0, channels(root): "nixos-18.09pre133640.ea145b68a01", nixpkgs: /etc/nixos/nixpkgs

Ok,I've got it working and did some research.

The first issue I've had which was really odd to me was that I had the wrong firefox extension, it has been working before. The only thing I can assume made it that way is that they released a separate extension when it became webextensions or something. But that doesn't make very much sense to me since the button was there in the browser.

So my first step to get this to work in firefox again was to remove the old one and install this one: https://addons.mozilla.org/en-US/firefox/addon/browserpass-ce/ (link is in README of browserpass github page).

I've also not managed to get it to work (in firefox) with the service for browserpass (programs.browserpass.enable = true;). But it works using the home-manager's option programs.browserpass.enable = true; which symlinks the same json-file to the home-directory instead of the firefox store path.

So this is still broken. Using browserpass-ce I get the suggestions but when clicking on them, it only displays "Error: An unexpected error occurred". Will this be fixed?

This works for me with firefox 59.0.1. IIUC, it won't work with firefox-bin.

$ firefox -v        
Mozilla Firefox 59.0.2

Hmmh. Installed via environment.systemPackages = with pkgs; [ firefox ];. Using programs.browserpass.enable = true; for browserpass.

Using browserpass-ce I get the suggestions but when clicking on them, it only displays "Error: An unexpected error occurred".

@wucke13 Could you try repeating this with the browser console open? (Ctrl-Shift-J to open the browser console.) That may give a more detailed error message.

sender.tab is undefined  main.js:614
    onConnect moz-extension://4e45aadd-f0f9-4cdc-9570-a879260fd7e6/background_scripts/main.js:614:15
    onConnect self-hosted:994:17
    <anonymous> moz-extension://4e45aadd-f0f9-4cdc-9570-a879260fd7e6/background_scripts/main.js:110:41
    apply self-hosted:4290:5
    applySafeWithoutClone resource://gre/modules/ExtensionCommon.jsm:301:16
    addListener/asyncWithoutClone/< resource://gre/modules/ExtensionCommon.jsm:1776:20
Error: WebExtension context not found! ExtensionParent.jsm:855:13
OpenGL compositor Initialized Succesfully.
Version: 3.0 Mesa 17.3.6
Vendor: Intel Open Source Technology Center
Renderer: Mesa DRI Intel(R) HD Graphics 5500 (Broadwell GT2) 
FBO Texture Target: TEXTURE_2D
stderr output from native app com.dannyvankooten.browserpass: [Browserpass] 2018/04/16 10:15:47 Unable to detect the location of gpg binary

An unexpected error occurred  background.js:64:11
    onMessage/< moz-extension://ca367b4a-7dde-4fb8-bf09-6c654a466ace/background.js:64:11
login is undefined  background.js:33
    fillLoginForm moz-extension://ca367b4a-7dde-4fb8-bf09-6c654a466ace/background.js:33:1
    onMessage/</< moz-extension://ca367b4a-7dde-4fb8-bf09-6c654a466ace/background.js:73:13
    apply self-hosted:4290:5
    applySafeWithoutClone resource://gre/modules/ExtensionCommon.jsm:301:16
    wrapPromise/< resource://gre/modules/ExtensionCommon.jsm:470:13
Unchecked lastError value: Error: Script 'moz-extension://ca367b4a-7dde-4fb8-bf09-6c654a466ace/inject.js' result is non-structured-clonable data  ExtensionCommon.jsm:425
    withLastError resource://gre/modules/ExtensionCommon.jsm:425:9
    wrapPromise/< resource://gre/modules/ExtensionCommon.jsm:478:11
Unchecked lastError value: Error: login is undefined  ExtensionCommon.jsm:425
    withLastError resource://gre/modules/ExtensionCommon.jsm:425:9
    wrapPromise/< resource://gre/modules/ExtensionCommon.jsm:478:11

Thats the output.
stderr output from native app com.dannyvankooten.browserpass: [Browserpass] 2018/04/16 10:15:47 Unable to detect the location of gpg binary looks interesting. How does that happen?

@wucke13 Do you have gpg in your system-packages or not?

I'd say that it shouldn't be needed, but might be needed.

No, I don't have it explicitly installed, but I have programs.gnupg.agent.enable = true;

If I look in the browserpass source, I found this function: https://github.com/dannyvankooten/browserpass/blob/4ca5c7c0d557f4aece063da54683eb04436d59be/browserpass.go#L135-L155

Which seems to be the one that failed. It's purpose seems to be to find a gpg binary. But it fails since it's not in your environment.

If I look in our package for browserpass https://github.com/NixOS/nixpkgs/blob/fbac1cbc06568380b538e81546e9d3b1715cab14/pkgs/tools/security/browserpass/default.nix -- I don't see that we patch the path to the gpg binary, which means that it must exist in the system environment for browserpass to find it.

A temporary fix for you would be to add gnupg to your system packages.

But in reality browserpass should be patched with our path to gpg.

The temporary fix does work for me. Closing since you started a PR on this. Great thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

vaibhavsagar picture vaibhavsagar  路  3Comments

edolstra picture edolstra  路  3Comments

matthiasbeyer picture matthiasbeyer  路  3Comments

retrry picture retrry  路  3Comments