SSLContext loads certificates from the "CA" Intermediate certificate store.
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 35.9k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
Bug report
Bug description:
ssl.py
class SSLContext(_SSLContext):
"""An SSLContext holds various SSL-related configuration options and
data, such as certificates and possibly a private key."""
_windows_cert_stores = ("CA", "ROOT")
When a certificate is imported into the windows "Intermediate Certification Authorities" most applications do not consider this a trusted CA and will fail to verify. Examples are the chrome browser and .Net Applications.
This can be tested using - https://untrusted-root.badssl.com/ and downloading the public key and importing into the "Intermediate Certificate Authorities".
Cert = Windows CertMgr Name
Root = Trusted Root Certification Authorities
CA = Intermediate Certification Authorities
Given that other applications (chrome, .Net) seem to not treat "CA" certificates as a trusted root, should python load these by default?
Use Case:
Using requests Adapter to load the windows certificates rather than rely on Certifi.
https://requests.readthedocs.io/en/latest/user/advanced/#:~:text=10%27%2C%20%27rel%27%3A%20%27last%27%7D-,Transport%20Adapters%C2%B6,-As%20of%20v1.0.0
class WindowsSSLContextAdapter(HTTPAdapter):
def __init__(self, url_prefix):
self.url_prefix = url_prefix
super().__init__()
def init_poolmanager(self, *args, **kwargs):
# loads CA and ROOT certificates on windows
context = ssl.create_default_context()
kwargs['ssl_context'] = context
return super().init_poolmanager(*args, **kwargs)
#Mount the HTTPAdapter on requests session
session.mount(url_prefix, adapter)
CPython versions tested on:
3.11
Operating systems tested on:
Windows
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia in ssl.py, su SSLContext._windows_cert_stores, e segui il modo in cui create_default_context() carica gli archivi dei certificati Windows. Confronta il comportamento attuale di CA e ROOT con la semantica di attendibilità di Windows segnalata e con la copertura specifica della piattaforma esistente. Il lavoro è completo quando il comportamento predefinito di caricamento dei certificati corrisponde al modello di attendibilità previsto ed è coperto da test Windows appropriati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- networking, security
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 42/100