Skip to content
This repository has been archived by the owner on May 27, 2019. It is now read-only.

Does not work on macOS (unless browser is started from terminal) #13

Closed
jceloria opened this issue Dec 2, 2016 · 68 comments
Closed

Does not work on macOS (unless browser is started from terminal) #13

jceloria opened this issue Dec 2, 2016 · 68 comments

Comments

@jceloria
Copy link

jceloria commented Dec 2, 2016

browserpass 0.1.2
Firefox: 50.0.2
Chrome: Version 54.0.2840.98 (64-bit)
macOS: 10.12.1-x86_64

$─► brew info pass
pass: stable 1.6.5 (bottled), HEAD
Password manager
https://www.passwordstore.org/
/usr/local/Cellar/pass/1.6.5_1 (27 files, 113.1K) *
  Poured from bottle on 2016-11-14 at 02:22:01
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/pass.rb
==> Dependencies
Required: pwgen ✔, tree ✔, gnu-getopt ✔
==> Requirements
Required: gpg2 ✔
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completion has been installed to:
  /usr/local/share/zsh/site-functions

I installed the browser extensions from the Chrome webstore and Firefox, downloaded browserpass-darwinx64.zip and ran install.sh, selected both Chrome and Firefox and restarted both browsers. When I attempt to use browserpass I'm just presented with the message "Error talking to Pass"

I am able to run pass from the command line without issue:

$─► pass Games/ea.com | sed -e '1 s/^.*$/none-yo/g' -e 's/^\(login: \).*/\1 business/g'
none-yo
---
login:  business
url: https://www.ea.com

Am I missing something?

@emersion
Copy link
Contributor

Can you start Chrome from the command line and see if an error message is printed?

@jceloria
Copy link
Author

Sure, thank you for the response!

[28164:60163:1211/113143:ERROR:native_process_launcher.cc(137)] Can't find manifest for native messaging host com.dannyvankooten.browserpass

@jceloria
Copy link
Author

Sorry, I had forgotten that I removed the binary, I reinstalled and got the following:
LaunchProcess: failed to execvp:
/Users/jceloria/Applications/browserpass-darwinx64/browserpass-darwinx64

I then checked the path to the binary and it was not executable, I changed the permissions and things are working as expected for Chrome, thank you and my apologies for not catching something so simple.

@jceloria
Copy link
Author

I get the following with Firefox:

1481480385534 [email protected] WARN Loading extension '[email protected]': Reading manifest: Error processing author: An unexpected property was found in the WebExtension manifest.
1481480385542 [email protected] WARN Please specify whether you want browser_style or not in your browser_action options.

@emersion
Copy link
Contributor

Does it work with Firefox? These are just warnings.

@jceloria
Copy link
Author

jceloria commented Dec 12, 2016 via email

@emersion
Copy link
Contributor

It seems that native messaging errors are not displayed in the terminal by Firefox. Can you check the browser console instead?

Source: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Native_messaging#Troubleshooting

@jceloria
Copy link
Author

jceloria commented Dec 12, 2016 via email

@dannyvankooten
Copy link
Collaborator

(Sorry for being so absent, I'm in the midst of my holiday and with limited internet. @emersion thanks for dropping by and helping out! I hope to be back in two weeks to work out some of these issues if needed & @emersion's PR.)

@Cadair
Copy link

Cadair commented Dec 19, 2016

fwiw, I am getting the same errors in the debug console as @jceloria. I am using Arch Linux and Firefox 50.0.1.

@emersion
Copy link
Contributor

@Cadair How did you install browserpass?

@jceloria Can you check debug.log?

@dannyvankooten No problem, thanks for your work!

@Cadair
Copy link

Cadair commented Dec 22, 2016

I installed the binary from the AUR package and the plugin from the firefox plugins "store"

@emersion
Copy link
Contributor

emersion commented Dec 22, 2016

@Cadair The binary from the AUR doesn't work because the latest release doesn't include a fix (#14). You can install browserpass-git instead.

@Cadair
Copy link

Cadair commented Dec 22, 2016

I seem to get a slightly different version of not working now.

Searching for: amazon.co.uk  script.js:99:3
The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol.  content.html
File closed  NativeMessaging.jsm:246
	_startRead/this.readPromise< resource://gre/modules/NativeMessaging.jsm:246:9
	loadExtensionInfo jar:file:///home/stuart/.mozilla/firefox/23btrlrk.default/extensions/%7B1EB88DA7-4F70-4E70-923F-810E4F0C9FDF%7D.xpi!/kango/loader.js:1:286
	<anonymous> chrome://kango-1eb88da7-4f70-4e70-923f-810e4f0c9fdf/content/includes/content_loader.js:1:1040
	PanelUI.showSubView/panelRemover< chrome://browser/content/customizableui/panelUI.js:364:9
	bound  self-hosted
TypeError: this.cloneScope is null[Learn More]

@jceloria
Copy link
Author

I've updated to v1.0.2 and now I'm receiving a different message:

Firefox:

Error: File closed  script.js:127:7
stderr output from native app com.dannyvankooten.browserpass: 2017/01/18 09:38:06 exec: "pass": executable file not found in $PATH

Chrome:
Works fine when I launch from the command line, times out when I start it from the launcher (I can only assume its having the same trouble)

$─► which pass; uname -a; echo; cat /etc/paths
/usr/local/bin/pass
Darwin ip-192-168-0-246.ec2.internal 16.3.0 Darwin Kernel Version 16.3.0: Thu Nov 17 20:23:58 PST 2016; root:xnu-3789.31.2~1/RELEASE_X86_64 x86_64 i386 MacBookPro11,4 Darwin

/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

@dannyvankooten
Copy link
Collaborator

dannyvankooten commented Feb 10, 2017

I have good hopes that 343722b will fix this issue @jceloria, can you please try building the Browserpass binary from master?

@jceloria
Copy link
Author

Thanks for looking into this... Unless I'm doing something wrong during the build, it still seems to be a issue:

$─► rm -rf $GOPATH browserpass/; echo -e "\nCloning repository: " && git clone https://github.com/dannyvankooten/browserpass.git && go get github.com/mattn/go-zglob && cd browserpass/ && rm -f browserpass.go && curl -O https://raw.githubusercontent.com/dannyvankooten/browserpass/343722bee3bfff3739caceee74d2a543505d8cd5/browserpass.go && echo -e "Done checking out latest release...\n" && echo "Current git diff: " && git diff --shortstat && echo -e "\nContinue building/installing: " && make browserpass-darwinx64 && mv -f browserpass-darwinx64 ~/Applications/browserpass-darwinx64 && cd - && echo "Done."

Cloning repository:
Cloning into 'browserpass'...
remote: Counting objects: 503, done.
remote: Compressing objects: 100% (49/49), done.
remote: Total 503 (delta 20), reused 0 (delta 0), pack-reused 452
Receiving objects: 100% (503/503), 421.03 KiB | 0 bytes/s, done.
Resolving deltas: 100% (292/292), done.
Done checking out latest release...

Current git diff:
 1 file changed, 23 insertions(+), 28 deletions(-)

Continue building/installing:
env GOOS=darwin GOARCH=amd64 go build -o browserpass-darwinx64
/Users/jceloria/repos
Done.

I have restarted both Chrome and Firefox and still just get a spinning circle trying to fill in a password box:
screen shot 2017-02-10 at 9 06 16 am

@jceloria
Copy link
Author

jceloria commented Feb 10, 2017

Apparently now, its no longer the pass binary but the gpg binary (for which I also installed via homebrew). There also seems to be a problem with the path to the found pass entry:
.password-storeEmployment/linkedin.com.gpg

stderr output from native app com.dannyvankooten.browserpass: [Browserpass] 2017/02/10 09:12:27 Password store is /Users/jceloria/.password-store
stderr output from native app com.dannyvankooten.browserpass: [Browserpass] 2017/02/10 09:12:27 Searching for linkedin.com
stderr output from native app com.dannyvankooten.browserpass: [Browserpass] 2017/02/10 09:12:30 Password store is /Users/jceloria/.password-store
stderr output from native app com.dannyvankooten.browserpass: [Browserpass] 2017/02/10 09:12:30 Reading password file /Users/jceloria/.password-storeEmployment/linkedin.com.gpg
stderr output from native app com.dannyvankooten.browserpass: [Browserpass] 2017/02/10 09:12:30 exec: "gpg": executable file not found in $PATH
Error: File closed  script.js:127:7
login is undefined
$─► which gpg gpg2
/usr/local/bin/gpg
/usr/local/bin/gpg2

@dannyvankooten
Copy link
Collaborator

It seems to be that Firefox is running as a different user (or at least running the binary as a different user) which doesn't have the brew linked libraries in its $PATH variable. Does it work if you invoke Firefox from the command-line?

@jceloria
Copy link
Author

$─► echo $(whoami && id -u) && ps -efw | awk '$0~/Firefox/ && $0!~/awk/ {print $1, $8}'
jceloria 501
501 /Applications/Firefox.app/Contents/MacOS/firefox
501 /Applications/Firefox.app/Contents/MacOS/plugin-container.app/Contents/MacOS/plugin-container

Previously, it did work before when starting from the cli, but now its not:

1486743986177	[email protected]	WARN	Loading extension '[email protected]': Reading manifest: Error processing author: An unexpected property was found in the WebExtension manifest.
console.info: **** loading module resource://donottrackplus-at-abine-dot-com/data/global.js
console.debug:
  initialized AbineContentPolicy
Extension error: TypeError: login is undefined moz-extension://025db812-7d7c-ab4a-903e-3ae8aab0300c/script.js 167
[[Exception stack
fillLoginForm@moz-extension://025db812-7d7c-ab4a-903e-3ae8aab0300c/script.js:167:45
getLoginData/<@moz-extension://025db812-7d7c-ab4a-903e-3ae8aab0300c/script.js:131:5
Current stack
runSafeSyncWithoutClone@resource://gre/modules/ExtensionUtils.jsm:62:129
runSafeWithoutClone@resource://gre/modules/ExtensionUtils.jsm:255:38
wrapPromise/</<@resource://gre/modules/ExtensionUtils.jsm:438:15
withLastError@resource://gre/modules/ExtensionUtils.jsm:378:14
wrapPromise/<@resource://gre/modules/ExtensionUtils.jsm:432:11
]]

@seanfarley
Copy link

For the Mac, it's nothing to do with the user id. There's no easy way to set environment variables for applications launched via the dock or finder. There are a few launchd commands but they're dubious at best (and I haven't been able to get one to reliably work).

The easiest solution would be to fallback to checking common locations (e.g. /opt/local/bin (MacPorts), /usr/local/bin (Homebrew), etc). If I was better at go, I would submit a PR, but alas.

@johnimorris
Copy link

johnimorris commented Apr 14, 2017

Hi guys, I am suffering from this too, on my Mac, but found a small workaround. While not ideal may help others to get it working until a proper solution can be found.

For me, it ended up being 2 things. The PATH didn't include /usr/local/bin, and since I run the curses gpg-agent, I had to make sure the GPG_AGENT_INFO and GPG_TTY environment variables were set. To make this happen:

  • I wrapped the browserpass-darwinx64 executable with a script I called "browserpass-wrapper".

  • I changed the ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.dannyvankooten.browserpass.json to call my browserpass-wrapper instead.

  • The browserpass-wrapper script looks like this:
    #############################
    #!/bin/bash

if [ -f "${HOME}/.gpg-agent-info" ]
then
source ${HOME}/.gpg-agent-info
export GPG_AGENT_INFO
fi
export GPG_TTY="$(tty)"
export PATH="$PATH:/usr/local/bin"
/Users/johnm/Projects/browserpass_binary/browserpass-darwinx64 "$@"
exit $?
###############################

The above script assumes I have a gpg agent running, writing its environment setting to ~/.gpg-agent-info.

Also, note, while the above script is run with no tty, setting GPG_TTY="$(tty)" makes GPG_TTY the value "not a tty", and it still seems to satisfy the gpg-agent.

Also, of course change the path of browserpass-darwinx64 to where ever you have it.

Hope this helps others, or paves the way to a better solution.

NOTE: I did this for chrome. Not sure if it helps with firefox, but sounds like the same symptoms.

@wilbowma
Copy link

FYI, I was having this issue as well, until I installed the native helper version 1.0.4.r0.f34c1c3-1. That solved it.
Firefox 52
Pass 1.7.1
Browerpass 1.0.3
ArchLinux

@joyarzun
Copy link

@johnimorris It works! Just remember give it chmod u+x to browserpass-wrapper

@samhh
Copy link

samhh commented Jul 5, 2017

@johnimorris No luck for me unfortunately. Same errors as I mentioned in the other issue: #28 (comment)

I guess my issue is different then?

@tverlaan
Copy link

@johnimorris thanks for the workaround!

@compuguy
Copy link

@johnimorris @samhh @tverlaan Didn't get workaround working. Could this be related to using GPGTools for gpg?

@ghost
Copy link

ghost commented Sep 27, 2017

@maximbaz Latest one works fine without any changes to the $PATH as long as pinentry-mac is used.

@maximbaz
Copy link
Member

Thanks! I'll leave the PR open for a day or two, to let more people try before closing this issue and claiming that it has been fixed.

Planning to make a new release on Friday, and also finally upload the browser extensions in the Webstores (under a new name, unfortunately, due to #117).

@troelsh
Copy link

troelsh commented Sep 28, 2017

@braderhart i believe if you have installed GGP Suite from https://gpgtools.org/ then it can use the os keychain for automatic pin-entry you have to turn that off in System Preferences -> GPG Suite. If you have done that then it will use pinentry-mac for every use of browser pass. Everything (except browserpass and pass) installed via the GPG Suite.

@maximbaz i will give it a try but i don't know if i can unfix my path now that i have "fixed it". I can try and restore it to something basic. And test your binary.

Too bad about the name on the extension store but i guess we can live with MAXBrowserPass 🦄 . Or maybe Browserpass Community Edition 🍻 (browserpass-ce).

PS. Kids pfffff 💃

@compuguy
Copy link

The test build from @maximbaz works great with GPGtools.

@sievertz
Copy link

I can also confirm that the test build from @maximbaz works with GPGtools! 👍

@maximbaz
Copy link
Member

At last, I'm happy to announce - fixed in v2.0.0! 🎉

@mandarvaze
Copy link

Installed v2.0.0 (and browserpass-ce, and pinentry-mac)
All is well !!!
👏

@samhh
Copy link

samhh commented Sep 30, 2017

Still not working for me out of the box...

macOS 10.12.6, Vivaldi 1.12.955.36, browserpass-ce 2.0.0, latest binary.

It can find my password files, but if I click on one nothing happens, the extension popup just closes.

@maximbaz
Copy link
Member

Are you using the GPGtools like others mentioned above?

@ghost
Copy link

ghost commented Sep 30, 2017 via email

@mandarvaze
Copy link

@samhh Does it work for Firefox and/or Chrome ? Could be Vivaldi specific issue ?

@samhh
Copy link

samhh commented Oct 2, 2017

I followed @braderhart's instructions which did get a GPG dialog to pop up successfully. Unfortunately after entering my password and hitting enter nothing is happening (dialog gone, not coming back). I've tested this in both Vivaldi and Chrome.

@maximbaz
Copy link
Member

maximbaz commented Oct 2, 2017

Could it be a specific website that is affected, i.e. can you repro the bug on github.com/login ?

#164 would help a lot in such investigations... 🙂

Could you also check that right clicking on browserpass icon > Inspect popup has an error "Error talking to browserpass" or something like that when you try select a password entry to fill in?

@samhh
Copy link

samhh commented Oct 2, 2017

Aha, okay, it is working. I've not actually been able to use Browserpass before due to the above issues so I didn't know what to expect, the autofill works surprisingly well! 😄 So my issue here is resolved, thank you all!

Outside the scope of this ticket, but are there plans to allow you to view the contents of the decrypted password file a la LastPass, rather than only click to autofill? I know there are a handful of websites I frequent where for one reason or another that's necessary, and it'd be annoying to have to pop open a terminal each time.

@maximbaz
Copy link
Member

maximbaz commented Oct 2, 2017

#105 will probably make you happy @samhh.

However I'll use this opportunity to stress out again, our goal is to mitigate phishing attacks by making autofill algorithm work as perfect as possible. There have been substantial improvements implemented recently thanks to people who share specific examples of websites where autofill is broken, I urge everyone to share more examples if you happen to stumble upon such.

@Sophia-Gold
Copy link

I'm also getting the "Error: Native host has exited" message from Chrome 55 and came here from #28 which didn't seem as OS specific

I'm on NixOS, although for some reason it couldn't locate the Browserpass packaged on channel nixos-17.03 so I installed it first from the Chrome web store and then later with your install script to see if that would fix the native messaging problem (although they're currently both the same version).

The problem persists if I launch Chrome from root. The only other thing I can think of is I haven't added usernames in my password file (either with a backslash on the pass-name or as a separate login), but even if that means Browserpass won't decrypt any passwords it shouldn't affect native messaging.

Any ideas?

@maximbaz
Copy link
Member

maximbaz commented Oct 8, 2017

Since your issue seems different from this one (different OS, running browser from terminal doesn't solve the problem), could you please create a new ticket and fill out the issue template? Please also mention at which stage you see this error, immediately after clicking on browserpass icon it toolbar or after you select a password entry.

Generally "Error: Native host has exited" means that the host app was discovered, but it crashed while performing its operation.

The structure of your pass files shouldn't be an issue, but try creating one with a fake username just to test this idea.

@raxod502
Copy link

raxod502 commented Dec 31, 2017

I have created a script patch-macos-app.zsh which can be used to modify any macOS application so that it sources ~/.profile on launch (without the need to launch through a wrapper script, and presumably also so that it works after a restart with the "reopen windows" option). Having put my $PATH and gpg-agent configuration in ~/.profile, applying this script to Google Chrome makes Browserpass work for me:

% ./patch-macos-app.zsh 'Google Chrome' 'Google Chrome' 'Google Chrome Core' --patch
Patched successfully: /Applications/Google Chrome.app

@davidbarratt
Copy link

To get this to work I had to:

brew install pinentry-mac
echo "pinentry-program /usr/local/bin/pinentry-mac" >> ~/.gnupg/gpg-agent.conf

Perhaps this should be added to the install instructions?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests