Skip to content

Commit af5a471

Browse files
Apply #2299 changes to async code
1 parent d5ee2e4 commit af5a471

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/snowflake/connector/aio/_ocsp_asn1crypto.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,18 @@ def extract_certificate_chain(self, connection: ResponseHandler):
3838
# https://docs.python.org/pl/3.13/library/ssl.html#ssl.SSLSocket.get_unverified_chain
3939
unverified_chain = ssl_object._sslobj.get_unverified_chain()
4040
logger.debug("# of certificates: %s", len(unverified_chain))
41-
41+
self._lazy_read_ca_bundle()
4242
for cert in unverified_chain:
4343
cert = Certificate.load(ssl.PEM_cert_to_DER_cert(cert.public_bytes()))
4444
logger.debug(
4545
"subject: %s, issuer: %s", cert.subject.native, cert.issuer.native
4646
)
4747
cert_map[cert.subject.sha256] = cert
48+
if cert.issuer.sha256 in SnowflakeOCSP.ROOT_CERTIFICATES_DICT:
49+
logger.debug(
50+
"A trusted root certificate found: %s, stopping chain traversal here",
51+
cert.subject.native,
52+
)
53+
break
4854

4955
return self.create_pair_issuer_subject(cert_map)

0 commit comments

Comments
 (0)