-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Don't pass --cert to build subprocesses unless also given on CLI #13195
Conversation
This fixes a regression introduced by commit 34fc0e2. After that patch, --cert would always be given to the nested pip call, either pointing to pip's CA bundle, or to whatever the user had set on the CLI. This means truststore is always disabled... which is bad. We used to have to do some shenanigans to pass the CA bundle to the subprocess as certifi doesn't (didn't?) really play nice when in a zipfile. Regardless, we stopped packing pip into a zipfile to provision the build environment a while ago, so we can simply do the normal thing and pass --cert when it's actually given. Otherwise, the subprocess will find its CA bundle without fuss. There apparently aren't any truststore tests (as testing system CAs is probably a pain), so I didn't add one here either. At some point, we should, though.
I'll note that we used to not pass any certificates to the subprocess1 before we used zipped pip. That's obviously not great if the user had specified Footnotes
|
Thanks for the history of this. |
I briefly tried to reproduce with 25.0 by mostly emptying the certifi cert file and attempting a no binary install but could not succeed. So this fix looks good to me but I don't quite understand it fully, and that worries me a bit. |
I realized that my work Windows environment relies on truststore, an environment I don't often use, so I tried to reproduce myself. I also can't reproduce, so I was looking carefully at #11647, and I find some things confusing:
In general this is making me think that:
I'm going to go back to #13186 and ask the user to run some specific commands |
@sbidoul I'm pretty sure requests doesn't use the SSLContext's CA bundle when We set pip/src/pip/_internal/cli/index_command.py Lines 107 to 109 in 028c087
|
Based on the discussion the updates in #13186 I think there is an issue (but not regression) here that extends outside the build steps. Specifically there is some edge case to passing in My guess is the broader solution is:
@sethmlarson do you have any input here? |
@notatallshaw Thanks for the tag-in! I'm in agreement that when passed a certificate path then Truststore should use that path and not use certifi, that matches pip's behavior prior to "Truststore by default" where I think that always using system certificates and then swapping out whether certifi or /something else/ is used as "additional" certificates the way to go. Longer-term phasing out certifi as a default set of additional certificates would be nice, too. Then there's no need to treat certifi security issues as pip issues. |
This fixes a regression introduced by commit 34fc0e2. After that patch, --cert would always be given to the nested pip call, either pointing to pip's CA bundle, or to whatever the user had set on the CLI. This means truststore is always disabled... which is bad.
We used to have to do some shenanigans to pass the CA bundle to the subprocess as certifi doesn't (didn't?) really play nice when in a zipfile. Regardless, we stopped packing pip into a zipfile to provision the build environment a while ago, so we can simply do the normal thing and pass --cert when it's actually given. Otherwise, the subprocess will find its CA bundle without fuss.
There apparently aren't any truststore tests (as testing system CAs is probably a pain), so I didn't add one here either. At some point, we should, though.
Fixes #13186.