Comment 6 for bug 1923727

Revision history for this message
Robie Basak (racb) wrote :

I agree this is really annoying.

Here are some reduced steps to reproduce if you need to test various configurations:

snap run --shell git-ubuntu
python3
import gitubuntu.source_information
gitubuntu.source_information.launchpad_login_auth()

Then you'll be prompted, or not, depending on what the keyring module does. When that function returns with a Launchpad object, auth is successful. You can just "exit"/Ctrl-D twice (once for Python; once for the snap environment shell) to get out from there when done.

git-ubuntu uses launchpadlib which uses keyring (https://pypi.org/project/keyring/) to store its API token. keyring can use a variety of backends. kwallet is one of them. There's also keyrings.alt (https://pypi.org/project/keyrings.alt/) which includes a PlaintextKeyring which just uses a file (no encryption). The git-ubuntu snap includes keyrings.alt, so can use PlaintextKeyring if that is configured.

You can configure the keyring module to just use PlaintextKeyring. Then it'll store the API key in a file, and you won't otherwise be bothered. To do this, put this in ~/.local/share/python_keyring/keyringrc.cfg:

[backend]
default-keyring=keyrings.alt.file.PlaintextKeyring

However, this will cause _all_ uses of the keyring module to store credentials in plain text. This may not be suitable for ordinary desktop users.

According to the keyring documentation, "The library will attempt to automatically choose the most suitable backend for the current environment". In Christian's case, is this because he happens to have kwallet installed? Maybe keyring is running through the backends to see what is available in some priority order? The version of keyring being used by git-ubuntu has probably changed - it is now using the version that ships with Focal (python3-keyring). Christian - does "lp-shell" do the same thing for you now, or different?

There is an option to explicitly set the keyring backend to use by API. git-ubuntu could do this. But should it be arbitrarily overriding the keyring default?

I hope the above explains what is going on. I agree it's annoying, but I'm also reluctant to have git-ubuntu behave differently from launchpadlib (and unfortunately I think we'll be stuck with Focal's default behaviour since the snap is based on Focal, in case there are any differences in other releases).

What do you think git-ubuntu should do?