You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SSL: CERTIFICATE_VERIFY_FAILED when using custom root CA in Windows #135408
When accessing external HTTPS sites using requests with pip-system-certs and/or defined cacert with the entire certificate path included the following error appears in all versions of 3.13:
r = threatSession.get(baseURL + "/auth/new", headers=headers) #, headers = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"})
File "C:\Program Files\Python313\Lib\site-packages\requests\sessions.py", line 602, in get
return self.request("GET", url, **kwargs)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python313\Lib\site-packages\requests\sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "C:\Program Files\Python313\Lib\site-packages\requests\sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "C:\Program Files\Python313\Lib\site-packages\requests\adapters.py", line 698, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='threatinsight.proofpoint.com', port=443): Max retries exceeded with url: /auth/new (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Missing Authority Key Identifier (_ssl.c:1020)')))
Would you mind reporting this to requests first? There's a chance that their internal usage of ssl is messed up. If it is a bug on our end, they'll come up with a pure-stdlib reproducer and come back to us.
@ZeroIntensity the reporter did that and the requests response shows it's not there. Any idea on a possible fix here? It's impacting some downstream things my team uses (that Jenkins consumes in their helm chart) and has broken things.
I don't specifically have a URL, but using https://github.com/kiwigrid/k8s-sidecar in Jenkins (it's contained in the Jenkins helm chart) is how I discovered this problem at all. And Grafana is experiencing the same issue. I don't honestly have a very simple repro case, and I apologize for that, but the linked requests issue definitely has a repro.
Now for the interesting part... I installed truststore and added the following lines to my code
import truststore
truststore.inject_into_ssl()
The script executed without issue
My conclusion is that there is something in the ssl handling of the .pem file, or the way the file is being passed to openssl, that is causing an issue with the validation. OpenSSL was able to use the pem file without issue.
I am surprised that pip_system_certs is also having an issue, as it is apparently calling truststore itself, but is erroring the same as providing a pem file. Or is this just the same issue in a different form.
I know it's been a while, but the cause of this is unrelated to cpython. It's entirely related to the stricter validation of certificates that Python 3.13+ enforce. A full explanation can be found here. Imo, this should be closed as it's not technically a problem here.
Activity
ZeroIntensity commentedon Jun 11, 2025
Would you mind reporting this to
requestsfirst? There's a chance that their internal usage ofsslis messed up. If it is a bug on our end, they'll come up with a pure-stdlib reproducer and come back to us.bengaywins commentedon Jun 26, 2025
@ZeroIntensity the reporter did that and the requests response shows it's not there. Any idea on a possible fix here? It's impacting some downstream things my team uses (that Jenkins consumes in their helm chart) and has broken things.
ZeroIntensity commentedon Jun 26, 2025
No clue, I hadn't seen that requests had isolated it down to urllib3. It's probably a bug with OpenSSL. I'll investigate this further sometime today.
bengaywins commentedon Jul 2, 2025
@ZeroIntensity were you able to find anything?
ZeroIntensity commentedon Jul 3, 2025
No, sorry, I couldn't reproduce it.
bengaywins commentedon Jul 3, 2025
Any suggestions on how we can narrow this down under the circumstances?
ZeroIntensity commentedon Jul 3, 2025
Do you have a URL that reproduces the bug? That would help me investigate.
bengaywins commentedon Jul 3, 2025
I don't specifically have a URL, but using https://github.com/kiwigrid/k8s-sidecar in Jenkins (it's contained in the Jenkins helm chart) is how I discovered this problem at all. And Grafana is experiencing the same issue. I don't honestly have a very simple repro case, and I apologize for that, but the linked requests issue definitely has a repro.
ZeroIntensity commentedon Jul 3, 2025
Yeah, I couldn't reproduce this using the snippet from requests.
If you can reproduce it on your end, please try this C code:
If this errors, it's an issue with OpenSSL.
DonNeelin commentedon Aug 28, 2025
Hi All,
I have revisted this and I have found some interesting behaviour...
The script executed without issue
My conclusion is that there is something in the ssl handling of the .pem file, or the way the file is being passed to openssl, that is causing an issue with the validation. OpenSSL was able to use the pem file without issue.
I am surprised that pip_system_certs is also having an issue, as it is apparently calling truststore itself, but is erroring the same as providing a pem file. Or is this just the same issue in a different form.
DonNeelin commentedon Aug 28, 2025
One last test. I modified the c program to use the pem file with the following code, and the connection was successful.
bengaywins commentedon Nov 13, 2025
I know it's been a while, but the cause of this is unrelated to cpython. It's entirely related to the stricter validation of certificates that Python 3.13+ enforce. A full explanation can be found here. Imo, this should be closed as it's not technically a problem here.