-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Multiple concurrent client certs broken with v2.32.3 #6726
Comments
Thanks for the report, @jeffreytolar. It does looks like we're not checking the certs provided by the Session before opting into the default context, I've put together fe251aa to disable the default context when certs are present. However, with testing I'm seeing an exception with the cert being self-signed that wasn't present in 2.31.0. I'm looking into that further but would you mind checking the above patch against your current setup so we can decouple the two issues. If your issue is persisting after we've moved the default context out of the hot path, there may be something else at play with the recent CVE fix. |
So far it's looking like that patch is working in our main setup - thanks for the quick commit! For the self-signed issue still in the reproducer, I think it's that 2.32.x isn't passing a CA bundle to urllib3, whereas 2.31 did that here: Lines 257 to 258 in 147c851
certifi
To restore the v2.31 behavior, I think maybe a |
Yeah, I thought the optimization broke the zipped paths extraction but couldn't prove it easily |
Ok, so that's the same issue reported here (#6710 (comment)) this morning. That explains why calling Let me take a closer look tomorrow, I'm a little worried if we do it only for |
Any updates on a release including a fix for this @nateprewitt ? |
We use
requests
with multiple mTLS client certificates - each certificate is signed by the same CA, but they have different subjects - each subject has different permissions. Each distinct client cert is used by a differentrequests.Session
Additionally, we make use of
ThreadPoolExecutor
to make many requests in parallel.When client certs are in use, urllib3 will load the cert into the SSL context, which, with concurrent requests, will cause the shared SSL context to get modified while it's in use.
The reproducer actually fails with an exception - when we first encountered this, we were seeing the wrong certs get used. (That was with different versions of python and openssl, however, and as mentioned above, they're all signed by the same CA, unlike the reproducer)
Expected Result
The reproducer below, when run with
requests-2.31.0
:Actual Result
When run with
requests-2.32.3
:Reproduction Steps
Gist: https://gist.github.com/jeffreytolar/ea05b3092df12dc6e5b518e58e6821ad ; this generates a few sets of key/certs, hackily sets the default CA bundle, and then makes a few concurrent requests, each using a distinct client cert.
With:
(top level dependencies are
pyOpenSSL
andrequests
)System Information
The text was updated successfully, but these errors were encountered: