提交 76558936 编写于 作者: J Jeremy Zafran

remove usernames and passwords for index URLs using basic auth from "Looking...

remove usernames and passwords for index URLs using basic auth from "Looking in indexes" log messages
上级 5bc94f33
......@@ -33,7 +33,7 @@ from pip._internal.utils.deprecation import RemovedInPip11Warning
from pip._internal.utils.logging import indent_log
from pip._internal.utils.misc import (
ARCHIVE_EXTENSIONS, SUPPORTED_EXTENSIONS, cached_property, normalize_path,
splitext,
remove_auth_from_url, splitext,
)
from pip._internal.utils.packaging import check_requires_python
from pip._internal.wheel import Wheel, wheel_ext
......@@ -193,7 +193,8 @@ class PackageFinder(object):
lines = []
if self.index_urls and self.index_urls != [PyPI.simple_url]:
lines.append(
"Looking in indexes: {}".format(", ".join(self.index_urls))
"Looking in indexes: {}".format(", ".join(
remove_auth_from_url(url) for url in self.index_urls))
)
if self.find_links:
lines.append(
......
......@@ -139,3 +139,18 @@ def test_secure_origin(location, trusted, expected):
logger = MockLogger()
finder._validate_secure_origin(logger, location)
assert logger.called == expected
def test_get_formatted_locations_basic_auth():
"""
Test that basic authentication credentials defined in URL
is not included in formatted output.
"""
index_urls = [
'https://pypi.org/simple',
'https://user:pass@repo.domain.com',
]
finder = PackageFinder([], index_urls, session=[])
result = finder.get_formatted_locations()
assert 'user' not in result and 'pass' not in result
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册