Page MenuHome GnuPG

pinentry sends libsecret error messages to stdout, which causes IPC error
Closed, ResolvedPublic

Description

if pinentry is compiled with libsecret, and libsecret has any problems talking
to the secret service, pinentry prints the libsecret error messages to stdout.

Since the error messages themselves are not formatted in libassuan IPC, this
produces an IPC error when gpg-agent is trying to talk to a misconfigured pinentry.

You can see this directly with:

$ DBUS_SESSION_BUS_ADDRESS=awefwef pinentry
OK Pleased to meet you
OPTION allow-external-password-cache
OK
SETKEYINFO monkeyman
OK
GETPIN
Failed to lookup password for key monkeyman with secret service: The name
org.freedesktop.secrets was not provided by any .service files
D abc123
OK
$

In normal use, this can happen when:

A.1) no secret service exists, or
A.2) gpg-agent is running with a bad default DBUS_SESSION_BUS_ADDRESS (e.g. if
it was running from a previous session, or was initialized before the current
dbus session)

and

B) gpg-agent is not configured with no-allow-external-cache

and

C) use of a secret key is requested by a client that does not know how to tell
gpg-agent which DBUS_SESSION_BUS_ADDRESS is currently in use (e.g. ssh-add,
talking to gpg-agent through its ssh-agent masquerade).

In the event of libsecret errors, the messages must not be routed to stdout,
since it breaks the assuan IPC protocol.

Details

Version
0.9.7

Event Timeline

dkg added projects: pinentry, Bug Report.
dkg added a subscriber: neal.
dkg added a subscriber: dkg.

A library should never ever send any diagnostics to stdout. That does not only
break pinentry but also all other tools which output to stdout. I suggest to
report that to libsecret.

I reported this to the libsecret maintainers, but it turns out that it was our
bug. Stef kindly replied a patch, which I've now applied (2f5bfa0). Looking
again at dkg's original message, he doesn't suggest that the problem is with
libsecret, but in fact correctly identified pinentry at the culprit.