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

Failure to authenticate private repository when URL-encoded character in password #3236

Closed
mjwillson opened this issue Nov 9, 2015 · 2 comments · Fixed by #4393
Closed
Labels
auto-locked Outdated issues that have been locked by automation

Comments

@mjwillson
Copy link
Contributor

See #51 (comment)

I have this issue with pip 7.1.2. There's a symbol in the password that needs url-encoding.

With the password url-encoded, pip fails to authenticate (gets a 401 response) and prompts for username/password interactively. It then works fine if I enter the user/pass interactively. Like @bcbrown I suspect it's not url-decoding the password.

@mjwillson
Copy link
Contributor Author

Confirmed from looking at https://github.com/pypa/pip/blob/develop/pip/download.py#L188 -- no url-decoding is being done.

@9nix00
Copy link

9nix00 commented Feb 7, 2017

It looks still have problem when use user & password in https without interactively.

the urllib parse password as port. I think I can fix this error.

but I read issue #3237 #3732 #3954. seems people worried use password clearly in url is not safe.

this may need to discuss. when we deploy project with robot, this feature is very useful.

[root@hostname ~]# /usr/local/var/pyenv/versions/3.4.3/bin/pip install -r ~/project/requirements/private.txt --index-url 'https://user@password:pypi.mydomain/simple'
Exception:
Traceback (most recent call last):
  File "/usr/local/var/pyenv/versions/3.4.3/lib/python3.4/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/local/var/pyenv/versions/3.4.3/lib/python3.4/site-packages/pip/commands/install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "/usr/local/var/pyenv/versions/3.4.3/lib/python3.4/site-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/local/var/pyenv/versions/3.4.3/lib/python3.4/site-packages/pip/req/req_set.py", line 554, in _prepare_file
    require_hashes
  File "/usr/local/var/pyenv/versions/3.4.3/lib/python3.4/site-packages/pip/req/req_install.py", line 278, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/usr/local/var/pyenv/versions/3.4.3/lib/python3.4/site-packages/pip/index.py", line 465, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "/usr/local/var/pyenv/versions/3.4.3/lib/python3.4/site-packages/pip/index.py", line 402, in find_all_candidates
    (Link(url) for url in dep_url_loc),
  File "/usr/local/var/pyenv/versions/3.4.3/lib/python3.4/site-packages/pip/index.py", line 404, in <listcomp>
    if self._validate_secure_origin(logger, link)
  File "/usr/local/var/pyenv/versions/3.4.3/lib/python3.4/site-packages/pip/index.py", line 285, in _validate_secure_origin
    origin = (parsed.scheme, parsed.hostname, parsed.port)
  File "/usr/local/var/pyenv/versions/3.4.3/lib/python3.4/urllib/parse.py", line 156, in port
    port = int(port, 10)
ValueError: invalid literal for int() with base 10: 'pypi.mydomain'

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 3, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
2 participants