Hi,

I have the attached application below that just tries to decrypt a file
with gpg2. When the gpg-agent has an empty cache (I temporarily set
max-cache-ttl to 0 while testing), the application has different
behavior when ran from a terminal or from a Firefox add-on:

1- in the terminal, I get the pinentry application that asks me to enter
   the passphrase for the gpg key used to encrypt the file;

2- when launched from a Firefox web extension's browser action (Firefox
   itself being launched with `web-ext run` from the same terminal), I
   just get an error: "Public key decryption failed: Operation
   canceled. Decryption failed: No secret key". I'm never asked for my
   passphrase.

Others have reported the exact same problem with another web-extension
and another native application (written in Go):
https://github.com/dannyvankooten/browserpass/issues/23

I checked the environment variables and they are very much similar (diff
attached).

Do you have any clue what could be different in the two environments
that could cause gpg2 to behave differently?

I sent the same message to the dedicated mailing-list at mozilla.org:
https://mail.mozilla.org/pipermail/dev-addons/2017-July/002966.html. They
suggested I contact you.

Thank you

-- 
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill
#!/usr/bin/env node

let {env} = require('process')

let {spawnSync} = require('child_process')

let gpg2 = spawnSync('gpg2', ['--decrypt', 
'/home/cassou/.password-store/github.com.gpg'], {
  stdio: ['ignore', 'pipe', 'pipe']
})

console.error('--------------------------env:')
console.error(env)
console.error('--------------------------stdout:')
console.error(gpg2.stdout.toString())
console.error('--------------------------stderr:')
console.error(gpg2.stderr.toString())
--- terminal.log	2017-07-12 17:49:52.753432383 +0200
+++ firefox.log	2017-07-12 17:47:55.536277521 +0200
@@ -11,7 +11,7 @@
 GJS_DEBUG_TOPICS=JS ERROR;JS LOG
 GNOME_DESKTOP_SESSION_ID=this-is-deprecated
 GPGKEY=E2490AB1
-GPG_TTY=/dev/pts/6
+GPG_TTY=/dev/pts/5
 HISTCONTROL=ignoredups
 HISTSIZE=1000
 HOME=/home/cassou
@@ -24,6 +24,7 @@
 LC_NUMERIC=fr_FR.UTF-8
 LC_PAPER=fr_FR.UTF-8
 LC_TIME=fr_FR.UTF-8
+LD_LIBRARY_PATH=/home/cassou/Downloads/firefox
 LESSOPEN=||/usr/bin/lesspipe.sh %s
 LOADEDMODULES=
 LOGNAME=cassou
@@ -32,10 +33,27 @@
 MAILDIR=/home/cassou/Mail
 MODULEPATH=/etc/scl/modulefiles:/etc/scl/modulefiles:/usr/share/Modules/modulefiles:/etc/modulefiles:/usr/share/modulefiles
 MODULESHOME=/usr/share/Modules
+MOZ_ASSUME_USER_NS=1
+MOZ_CRASHREPORTER_DATA_DIRECTORY=/home/cassou/.mozilla/firefox/Crash Reports
+MOZ_CRASHREPORTER_EVENTS_DIRECTORY=/tmp/f03e27ce-dcb5-4c81-bf79-f28cd928abb3/crashes/events
+MOZ_CRASHREPORTER_PING_DIRECTORY=/home/cassou/.mozilla/firefox/Pending Pings
+MOZ_CRASHREPORTER_RESTART_ARG_0=/home/cassou/Downloads/firefox/firefox
+MOZ_CRASHREPORTER_RESTART_ARG_1=-start-debugger-server
+MOZ_CRASHREPORTER_RESTART_ARG_2=6005
+MOZ_CRASHREPORTER_RESTART_ARG_3=-foreground
+MOZ_CRASHREPORTER_RESTART_ARG_4=-no-remote
+MOZ_CRASHREPORTER_RESTART_ARG_5=-profile
+MOZ_CRASHREPORTER_RESTART_ARG_6=/tmp/f03e27ce-dcb5-4c81-bf79-f28cd928abb3
+MOZ_CRASHREPORTER_RESTART_ARG_7=
+MOZ_CRASHREPORTER_STRINGS_OVERRIDE=/home/cassou/Downloads/firefox/browser/crashreporter-override.ini
+MOZ_LAUNCHED_CHILD=
+MOZ_NO_REMOTE=1
+NO_AT_BRIDGE=1
+NO_EM_RESTART=
+NS_TRACE_MALLOC_DISABLE_STACKS=1
 NVM_DIR=/home/cassou/.nvm
-OLDPWD=/home/cassou/Documents/projects/firefox/passwe/add-on
 PATH=/home/cassou/.local/bin:/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/cassou/node_modules/.bin
-PWD=/home/cassou/Documents/projects/firefox/passwe/app
+PWD=/home/cassou/Documents/projects/firefox/passwe/add-on
 QTDIR=/usr/lib64/qt-3.3
 QTINC=/usr/lib64/qt-3.3/include
 QTLIB=/usr/lib64/qt-3.3/lib
@@ -63,4 +81,11 @@
 XDG_SESSION_TYPE=x11
 XDG_VTNR=2
 XMODIFIERS=@im=ibus
-_=./index.js
+XPCOM_DEBUG_BREAK=stack
+XRE_BINARY_PATH=
+XRE_PROFILE_LOCAL_PATH=
+XRE_PROFILE_NAME=
+XRE_PROFILE_PATH=
+XRE_START_OFFLINE=
+XUL_APP_FILE=
+_=/usr/bin/web-ext
_______________________________________________
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users

Reply via email to