-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Allow environment variable references to be passed through to the Pipfile unredacted #5298
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
Conversation
… from being redacted. ****
|
I'll add a news fragment before merging once this gets reviewed. |
oz123
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The string method of package.link should redact the authentication according to the code here:
https://github.com/pypa/pip/blob/65680b4bb1a2412e97bc90e49df6999b5f362e40/src/pip/_internal/models/link.py#L93
I suspect the f-string (which calls the repr ) should be also using the string method explicitly.
In other words: package.link should not show auth information.
|
@oz123 That is the problem -- people are using environment variables for the auth and they get redacted. |
|
I still don't understand what issue is being fixed here. We should not leak authentication information to Pipefile or Pipefile.lock. |
Redacted from where? From the Pipefile? That's great, pipenv does its job. |
|
@oz123 For the case where the user is using environment variables, they don't get expanded, but they do get redacted, which means this doesn't work: Becasue str(package.link) will redact it to be If you have just a user variable, like this: Which creates a not lockable or installable Pipfile. The ask of #2635 is to fix this -- but you are probably correct as well, we need a way to detect if they are environment variables, to not redact them. |
|
OK, I see where is the problem. These are not environment variables, rather references to them. So if someone was smart and didn't specify the password, pip's own code still think it's a password. Using Something could be:
|
|
Changes made to address the concerns and tests added for the various cases. |
|
@oz123 this PR is insightful, because mac os failed on every test pips_to_dep tests regarding requests, possibly because of my new Pipfile tests? I noticed a weird behavior on my mac this past week that took me a while to track down -- even if there is no virtualenv, if there is a Pipfile in a higher level directory, then pipenv prefers to use that over the Pipfile in your current working directory, at least on a mac. |
Fixes #2635