Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessary keyring querying for URLs without need for credentials #8613

Closed
hroncok opened this issue Jul 22, 2020 · 3 comments
Closed

Unnecessary keyring querying for URLs without need for credentials #8613

hroncok opened this issue Jul 22, 2020 · 3 comments

Comments

@hroncok
Copy link
Contributor

hroncok commented Jul 22, 2020

Environment

  • pip version: 19.3.1, 20.1.1, 20.2b1
  • Python version: 3.8
  • OS: Fedora 32

Description

When an user installs a package with dependencies, for each dependency, the keyring (#5952) is prompted for credentials to https://pypi.org/simple and pypi.org and files.pythonhosted.org:

$ python3.8 -m venv --system-site-packages __venv__
$ . __venv__/bin/activate

(__venv__)$ pip list | grep keyring
keyring                       21.2.0  

(__venv__)$ pip install -U pip
...
Successfully installed pip-20.1.1

(__venv__)$ pip install gertty -vvv | grep credentials
Getting credentials from keyring for https://pypi.org/simple
Getting credentials from keyring for pypi.org
  Getting credentials from keyring for files.pythonhosted.org
Getting credentials from keyring for https://pypi.org/simple
Getting credentials from keyring for pypi.org
Getting credentials from keyring for https://pypi.org/simple
Getting credentials from keyring for pypi.org
  Getting credentials from keyring for files.pythonhosted.org
Getting credentials from keyring for https://pypi.org/simple
Getting credentials from keyring for pypi.org
Getting credentials from keyring for https://pypi.org/simple
Getting credentials from keyring for pypi.org
Getting credentials from keyring for https://pypi.org/simple
Getting credentials from keyring for pypi.org
Getting credentials from keyring for https://pypi.org/simple
Getting credentials from keyring for pypi.org
  Getting credentials from keyring for files.pythonhosted.org

(__venv__)$ yes | pip uninstall SQLAlchemy alembic gertty ordereddict python-editor urwid voluptuous
...

(__venv__)$ pip install -U --pre pip
...
Successfully installed pip-20.2b1

(__venv__)$ pip install gertty -vvv | grep credentials
Getting credentials from keyring for https://pypi.org/simple
Getting credentials from keyring for pypi.org
  Getting credentials from keyring for files.pythonhosted.org
Getting credentials from keyring for https://pypi.org/simple
Getting credentials from keyring for pypi.org
Getting credentials from keyring for https://pypi.org/simple
Getting credentials from keyring for pypi.org
  Getting credentials from keyring for files.pythonhosted.org
Getting credentials from keyring for https://pypi.org/simple
Getting credentials from keyring for pypi.org
Getting credentials from keyring for https://pypi.org/simple
Getting credentials from keyring for pypi.org
Getting credentials from keyring for https://pypi.org/simple
Getting credentials from keyring for pypi.org
Getting credentials from keyring for https://pypi.org/simple
Getting credentials from keyring for pypi.org
  Getting credentials from keyring for files.pythonhosted.org

When the keyring is not accessible, this prompts the user for the keyring password all times and produces a lot of warnings:

WARNING: Keyring is skipped due to an exception: Failed to unlock the collection!
WARNING: Keyring is skipped due to an exception: Failed to unlock the collection!
WARNING: Keyring is skipped due to an exception: Failed to unlock the collection!
WARNING: Keyring is skipped due to an exception: Failed to unlock the collection!
WARNING: Keyring is skipped due to an exception: Failed to unlock the collection!

I do not know yet how to reproduce the locked keyring issue yet, but our user was hit by it:

https://bugzilla.redhat.com/show_bug.cgi?id=1859476

Expected behavior

Keyring should not be queried for URLs that work without authentication. The original issue #5948 only speaks about when a 401 is being handled situation, not all.

@hroncok
Copy link
Contributor Author

hroncok commented Jul 22, 2020

Ok, here how's to get the bad UX:

  1. run seahorse

_

  1. lock the keyrings:

_

__

  1. Run pip install ... and for each keyring prompt, click cancel, because you don't want the keyring to open or you don't remember the password:

Sorry for the Czech locales, I've tried to set English, but the prompt for keyring password is form some daemon.

video

@dtantsur
Copy link

The sad thing is, I see it without even having a keyring (no "Passwords" section in seahorse). And I have no clue what my password (for the absent keyring) is.

@pradyunsg
Copy link
Member

Closing as a duplicate of #8090.

Quoting myself from that issue:

We need someone familiar with keyring, to look at pip._internal.network.auth and see what would be a good way to resolve this issue. :)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants