-
Notifications
You must be signed in to change notification settings - Fork 3k
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
pip freeze prints out username and password from URLs with them #11410
Comments
A pull request fixing this would be welcome! We have a |
Personally I’m not actually sure this is undesired. The freeze file is supposed to reflect the installation (different from stdout as in the linked issue, which is merely informational), and redacting the password means a part of the installation information is lost in the process. For this instance specifically, the user passed in the password in plain text (from pip’s perspective; the password was in plain text in the environment varialbe when pip was invoked and was resolved outside of pip by the shell), so I would expect the user to accept the password to be spit out in plain text, and modify the file afterward to accomodate the fact. |
I agree. Presumably the password is also stored in the |
When doing In the scenario of the OP, the credentials are stored in So we have a minor discrepancy between editables and non-editable VCS installs. |
@sbidoul What is the reasoning for stripping the credentials from a VCS URL in Specifically, I'm referring to this section of the specification in PEP 610:
|
@connesy I had lost track of this.
I don't understand your question, actually. When the credentials are specified as environment variables, they should not be stripped. Di you suspect a bug in that area? |
@sbidoul I have a
When installed, this results in the following {
"url": "https://gitlab.com/ds-api/team-ai-projects/team-ai-internal-projects/ml_framework.git",
"vcs_info": {
"commit_id": "fcff07aa9c2d4eec7277b704f0433cf07157910d",
"requested_revision": "fcff07aa9c2d4eec7277b704f0433cf07157910d",
"vcs": "git"
}
} |
Here's a reproducible example: $ mkdir pip-test; cd pip-test
$ echo "resolvelib @ git+https://${TEST_USER}:${TEST_PASS}@github.com/sarugaku/resolvelib@1.0.1" > requirements.txt
$ python3 -m venv .venv
$ . .venv/bin/activate
$ export TEST_USER="test-user"
$ export TEST_PASS="test-pass"
$ pip install -r requirements.txt
Collecting resolvelib@ git+https://test-user:test-pass@github.com/sarugaku/resolvelib@1.0.1
Cloning https://test-user:****@github.com/sarugaku/resolvelib (to revision 1.0.1) to /tmp/pip-install-tc_m1ch1/resolvelib_3b1b65ad2a5f40d3abd6e2ad2b47bf40
Running command git clone --filter=blob:none --quiet 'https://test-user:****@github.com/sarugaku/resolvelib' /tmp/pip-install-tc_m1ch1/resolvelib_3b1b65ad2a5f40d3abd6e2ad2b47bf40
Running command git checkout -q 969c5c75ded426dac43eff9619e1e857f22f37bb
Resolved https://test-user:****@github.com/sarugaku/resolvelib to commit 969c5c75ded426dac43eff9619e1e857f22f37bb
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: resolvelib
Building wheel for resolvelib (pyproject.toml) ... done
Created wheel for resolvelib: filename=resolvelib-1.0.1-py2.py3-none-any.whl size=17195 sha256=65a348cbee61a74aca5e5607396966e334d5f8e4e8e265948390e0ed5dfe7b32
Stored in directory: /tmp/pip-ephem-wheel-cache-itj5byo9/wheels/d2/9b/d2/f0b866d96f90c3c83d59b56cb3f2925028a79a0742f1c9e52d
Successfully built resolvelib
Installing collected packages: resolvelib
Successfully installed resolvelib-1.0.1
$ python -m json.tool .venv/lib/python3.10/site-packages/resolvelib-1.0.1.dist-info/direct_url.json
{
"url": "https://github.com/sarugaku/resolvelib",
"vcs_info": {
"commit_id": "c9ef371ad96e698bf3e0bb09acc682bd43e39bd7",
"requested_revision": "1.0.1",
"vcs": "git"
}
} The pip install log shows that the credentials are resolved in the URL by |
Thanks for the reproducer. This looks like a bug, I'll investigate. |
The fix for the plain text password in logs is in #12350. |
The OP is about editable installs. That is something we may want to fix although I am not entirely sure how. Probably stripping the user and password entirely, because the environment variables names are lost at that point, as they have been resolved by the shell. This part about editables is unrelated to direct URLs, since for editables, @connesy's #11410 (comment) is a different issue. |
@sbidoul Do you want me to create a separate issue on this? |
Yes please. Thank you. |
Description
When I do
pip freeze
, it prints out the username and password that I included while cloning the local modules \ repositoriesSimilar to : #4746
Expected behavior
Passwords should'nt be shown
pip version
21.1.1
Python version
3.8.10
OS
Centos7
How to Reproduce
git clone -b my_branch https://$gusr:$gpwd@gitlab.com/my-repo.git
cd my-repo
pip install -e .
Output
Code of Conduct
The text was updated successfully, but these errors were encountered: