Visitar URL original
Support credentials in configuration for private PyPI · Issue #4315 · pypa/pip · GitHub
Skip to content

Support credentials in configuration for private PyPI #4315

Closed

Description

@prokopst

Right now credentials for index-url in the configuration are stored in the url itself. I propose to somehow support credentials directly (or explicitly) in the configuration for private PyPIs because of following reasons:

  1. Right now credentials are leaked on multiple places. With this configuration:
[global]
index-url = https://thisis:test@pypi.python.org/simple
[search]
index = https://thisis:test@pypi.python.org/pypi

pip install --help shows:

Package Index Options (including deprecated options):
-i, --index-url Base URL of Python Package Index (default https://thisis:test@pypi.python.org/simple). This should point to a repository compliant with PEP 503 (the simple repository API) or a local directory laid out in the same format.

pip search --help shows:

Search Options:
-i, --index Base URL of Python Package Index (default https://thisis:test@pypi.python.org/pypi)

  1. With more exotic characters in the password it's not possible to use credentials in url at all:
[global]
index-url = https://username:pass/@word@pypi.python.org/simple
[search]
index = https://username:pass/@word@pypi.python.org/pypi
  1. AFAIK NuGet, mvn and npm support explicit auth since it's a good practice.

Activity

  1. zmt commented on May 12, 2017

    @zmt

    Also see #4475.

  2. chrahunt commented on Oct 27, 2018

    @chrahunt
    Member

    The situation is slightly better if using ~/.netrc e.g.

    machine pypi.python.org
    login username
    password pass/@word
    

    However netrc does not support spaces in the username or password fields. This would be fixed by python/cpython#127.

  3. cjerdonek commented on Oct 27, 2018

    @cjerdonek
    Member

    Independent of adding separate fields for the credentials, the passwords should not be leaking. PR #5773 (now merged) should help with addressing that issue: #5773

  4. cjerdonek commented on Oct 30, 2018

    @cjerdonek
    Member
    1. With more exotic characters in the password it's not possible to use credentials in url at all:

    Regarding (2), have you tried percent-encoding the username and password prior to including it in the URL (e.g. using Python 3's urllib.parse.quote()? On inspection, it looks like this should already be working in the currently released pip. If not, it would be good to know for sure. You can see that pip is unquoting these values in the download code here:

    userinfo = netloc.rsplit("@", 1)[0]
    if ":" in userinfo:
    user, pwd = userinfo.split(":", 1)
    return (urllib_unquote(user), urllib_unquote(pwd))
    return urllib_unquote(userinfo), None

  5. chrahunt commented on Oct 8, 2019

    @chrahunt
    Member

    The best proposal we have for an improvement in this area right now is #4263, so I will close this issue in favor of that one.

    As mentioned by @cjerdonek, there should be no credentials leaking in log output or otherwise. If anyone is seeing this, please check for and file if issue if not already present.

  6. added
    auto-lockedOutdated issues that have been locked by automation
    on Nov 7, 2019
  7. locked as resolved and limited conversation to collaborators on Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: configurationConfiguration management and loadingauto-lockedOutdated issues that have been locked by automationtype: enhancementImprovements to functionalitytype: securityHas potential security implications

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions