Skip to content

Special credential characters in extra index url #63

@titleistfour

Description

@titleistfour

Hello we have a requirement to mirror packages from a Pip repo protected with user/pass at nautobot.jfrog.io. The username contains both a + and @ character and no matter what I try I can't get Morgan to successfully auth to that index url.

Have tried using a .netrc file with the creds there. That works just running pip command but not with Morgan. Seems to be ignored.

Also tried encoding the special charaters but it still fails.

username: manage-service+name@network.com
encoded_username: manage-service%2Bname%40network.com

url: https://manage-service+name@network.com:xxxxxxxxxxxxx@nautobot.jfrog.io/artifactori/api/pypi/pypi-virtual/simple/
encoded_url: https://manage-service%2Bname%20network.com:xxxxxxxxxxxxxx@nautobot.jfrog.io/artifactori/api/pypi/pypi-virtual/simple/

These all seem to throw the same exceptions.

[admin@server1 ~]$ morgan -i /var/www/pip_mirror -c morgan-prod.ini -I https://manage-service%2Bname%20network.com:xxxxxxxxxxxxxxxxxxxxxxx@nautobot.jfrog.io/artifactori/api/pypi/pypi-virtual/simple/ mirror
nautobot-os-upgrades
Traceback (most recent call last):
  File "/usr/lib64/python3.9/http/client.py", line 895, in _get_hostport
    port = int(host[i+1:])
ValueError: invalid literal for int() with base 10: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@nautobot.jfrog.io'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/home/admin/.local/bin/morgan", line 8, in <module>
    sys.exit(main())
  File "/home/admin/.local/pipx/venvs/morgan/lib64/python3.9/site-packages/morgan/__init__.py", line 583, in main
    mirror(args)
  File "/home/admin/.local/pipx/venvs/morgan/lib64/python3.9/site-packages/morgan/__init__.py", line 487, in mirror
    m.mirror(f"{package}")
  File "/home/admin/.local/pipx/venvs/morgan/lib64/python3.9/site-packages/morgan/__init__.py", line 79, in mirror
    deps = self._mirror(requirement)
  File "/home/admin/.local/pipx/venvs/morgan/lib64/python3.9/site-packages/morgan/__init__.py", line 145, in _mirror
    with urllib.request.urlopen(request) as response:
  File "/usr/lib64/python3.9/urllib/request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib64/python3.9/urllib/request.py", line 517, in open
    response = self._open(req, data)
  File "/usr/lib64/python3.9/urllib/request.py", line 534, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/lib64/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/usr/lib64/python3.9/urllib/request.py", line 1389, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/usr/lib64/python3.9/urllib/request.py", line 1342, in do_open
    h.set_tunnel(req._tunnel_host, headers=tunnel_headers)
  File "/usr/lib64/python3.9/http/client.py", line 883, in set_tunnel
    self._tunnel_host, self._tunnel_port = self._get_hostport(host, port)
  File "/usr/lib64/python3.9/http/client.py", line 900, in _get_hostport
    raise InvalidURL("nonnumeric port: '%s'" % host[i+1:])
http.client.InvalidURL: nonnumeric port: 'xxxxxxxxxxxxxxxxxxxxxx@nautobot.jfrog.io'
[admin@server1 ~]$

Can anyone suggest a solution for this? A better way to pass those creds in to Morgan. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions