Conversation
blink1073
commented
Sep 8, 2026
blink1073
force-pushed
the
PYTHON-5805
branch
from
September 25, 2026 13:03
c40ae84 to
d6ea9c2
Compare
_extract _async_wrap_socket_tls / _wrap_socket_tls so TLS can be applied to sockets obtained from a KMS connect callback, and shield the executor handshake so cancellation cannot orphan the wrapped socket.
Add KMSConnectContext and the kms_connect_callback option to AutoEncryptionOpts and ClientEncryption so callers can route KMS connections through an HTTP proxy. The driver performs the KMS TLS handshake over the returned socket, so verification still targets the KMS host, and CSOT deadlines cover the callback. For ordinary proxies, callers can pass the new HTTPProxyKMSConnect or AsyncHTTPProxyKMSConnect helper instead of writing a callback. Enforce the CSOT deadline across the proxy tunnel, relay, and TLS handshake, and make the async callback contract strict: coroutine functions for the async API, plain callables rejected.
Cover the callback contract, proxy tunnel and relay, CONNECT status handling, CSOT deadline enforcement, and cancellation safety.
blink1073
force-pushed
the
PYTHON-5805
branch
from
September 25, 2026 13:44
d6ea9c2 to
47e250c
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PYTHON-5805
Changes in this PR
Lets CSFLE and Queryable Encryption route KMS traffic through an HTTP proxy via a user-supplied connect callback, while still performing the KMS TLS handshake end to end against the KMS host.
kms_connect_callbacktoAutoEncryptionOpts,ClientEncryption, andAsyncClientEncryption, plus aKMSConnectContext.HTTPProxyKMSConnect/AsyncHTTPProxyKMSConnecthelpers.pymongo/pool_shared.py, leaving existing connection paths unchanged.Test Plan
Ran the encryption prose suite against the drivers-evergreen-tools proxies: 10 passed, 2 skipped.
just lint,just typing, andjust docsclean.Checklist
Checklist for Author
Checklist for Reviewer