1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

redact passwords in output when using --find-links (#6489)

This commit is contained in:
Andreas Lutro 2019-05-22 23:33:41 +02:00 committed by Xavier Fernandez
parent c34191ff75
commit 9eccfae10d
3 changed files with 12 additions and 6 deletions

1
news/6489.bugfix Normal file
View file

@ -0,0 +1 @@
Hide passwords in output when using ``--find-links``.

View file

@ -660,7 +660,8 @@ class PackageFinder(object):
)
if self.find_links:
lines.append(
"Looking in links: {}".format(", ".join(self.find_links))
"Looking in links: {}".format(", ".join(
redact_password_from_url(url) for url in self.find_links))
)
return "\n".join(lines)

View file

@ -183,14 +183,18 @@ def test_get_formatted_locations_basic_auth():
"""
index_urls = [
'https://pypi.org/simple',
'https://user:pass@repo.domain.com',
'https://repo-user:repo-pass@repo.domain.com',
]
finder = PackageFinder.create([], index_urls, session=[])
find_links = [
'https://links-user:links-pass@page.domain.com'
]
finder = PackageFinder.create(find_links, index_urls, session=[])
result = finder.get_formatted_locations()
assert 'user' in result
assert '****' in result
assert 'pass' not in result
assert 'repo-user:****@repo.domain.com' in result
assert 'repo-pass' not in result
assert 'links-user:****@page.domain.com' in result
assert 'links-pass' not in result
@pytest.mark.parametrize(