Skip to content

Commit

Permalink
Redact index password from logs
Browse files Browse the repository at this point in the history
Closes pypa#6124
  • Loading branch information
xavfernandez committed Jan 10, 2019
1 parent 4771470 commit 01224df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/6124.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Redact the password from index urls in a debug message (using --no-index & --verbose options together)
9 changes: 7 additions & 2 deletions src/pip/_internal/cli/base_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
)
from pip._internal.req.req_file import parse_requirements
from pip._internal.utils.logging import setup_logging
from pip._internal.utils.misc import get_prog, normalize_path
from pip._internal.utils.misc import (
get_prog, normalize_path, redact_password_from_url,
)
from pip._internal.utils.outdated import pip_version_check
from pip._internal.utils.typing import MYPY_CHECK_RUNNING

Expand Down Expand Up @@ -287,7 +289,10 @@ def _build_package_finder(
"""
index_urls = [options.index_url] + options.extra_index_urls
if options.no_index:
logger.debug('Ignoring indexes: %s', ','.join(index_urls))
logger.debug(
'Ignoring indexes: %s',
','.join(redact_password_from_url(url) for url in index_urls),
)
index_urls = []

return PackageFinder(
Expand Down

0 comments on commit 01224df

Please sign in to comment.