-
Notifications
You must be signed in to change notification settings - Fork 1.1k
PYTHON-5309 Ensure AsyncMongoClient doesn't use PyOpenSSL #2286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
efe494d
add is_sync param
sleepyStick b29d1ba
update contributing
sleepyStick d9dfb99
add vars for pyopenssl and test
sleepyStick c847f25
update evergreen config to run this pyopenssl on async as well (not s…
sleepyStick ae8ecc4
fix typing
sleepyStick 03f4ba1
fix tests
sleepyStick 5349164
fix test pt2
sleepyStick 67100fc
edit evergreen config
sleepyStick 88ae345
fix test
sleepyStick e451ceb
fix test errors
sleepyStick 0312acb
fix typo...
sleepyStick 4e85024
fix typing
sleepyStick dccd96a
Merge branch 'master' into PYTHON-5309
sleepyStick c86a85f
maybe this works?
sleepyStick 12ef993
fix typing
sleepyStick bc76aae
fix tests
sleepyStick a9c63c8
fix typing again
sleepyStick 67c6738
fix tests pt 2?
sleepyStick 3ea4de7
fix test pt3
sleepyStick 38ad677
Merge branch 'master' into PYTHON-5309
sleepyStick c57aed2
add test_name
sleepyStick 2591169
address review
sleepyStick 06a710d
update changelog
sleepyStick ef4111e
undo whitespace changes
sleepyStick 0b3c6bb
fix failures
sleepyStick 9336f58
fix typing
sleepyStick 23b7cbe
fix typing?
sleepyStick 760fa97
fix error?
sleepyStick 4b8a4ed
undo whitespace changes
sleepyStick 5807ba1
more whitespace changes
sleepyStick 683ba33
move kms_ssl_contexts
sleepyStick d007c5f
fix import
sleepyStick 05c061a
fix test failures
sleepyStick 350f103
fix test failure pt2
sleepyStick 5fa117f
change changelog line ft noah's suggestion
sleepyStick 56c9662
_ssl -> _stdssl and ssl_in_use -> _ssl
sleepyStick a7324e5
make combined error type
sleepyStick af83d81
jk cant do _stdssl
sleepyStick f6b17dd
_pysslConn back to _sslConn
sleepyStick 74ca8be
fix _ssl and has_sni
sleepyStick 536f189
fix test
sleepyStick 24354b4
_ssl -> ssl
sleepyStick 4178fcc
Merge branch 'master' into PYTHON-5309
sleepyStick b2324e3
Merge branch 'master' into PYTHON-5309
sleepyStick 17cf61d
Update pymongo/asynchronous/pool.py
sleepyStick 257f8fe
Update doc/changelog.rst
sleepyStick 74f98c5
Update pymongo/asynchronous/pool.py
sleepyStick 6752a67
address review
sleepyStick 750a9aa
fix error
sleepyStick e7e36b4
Merge branch 'master' into PYTHON-5309
sleepyStick 8af8f09
fix typing
sleepyStick 16d3cc3
Merge branch 'PYTHON-5309' of github.com:sleepyStick/mongo-python-dri…
sleepyStick 6971fed
back to tuple type
sleepyStick 4d12c59
remove added section
sleepyStick a0fe2e5
modify encryption tests
sleepyStick 7b4ae9c
fix test
sleepyStick f02a791
change test
sleepyStick 4ed055e
close the client
sleepyStick 981a046
fix the tests pt3
sleepyStick c20623f
fix typing
sleepyStick bdaf87a
fix import
sleepyStick c2b2cc3
fix typing and add comment in encryption
sleepyStick File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,8 @@ | |
|
||
from typing import TYPE_CHECKING, Any, Mapping, Optional | ||
|
||
from pymongo.uri_parser_shared import _parse_kms_tls_options | ||
|
||
try: | ||
import pymongocrypt # type:ignore[import-untyped] # noqa: F401 | ||
|
||
|
@@ -34,6 +36,7 @@ | |
from pymongo.errors import ConfigurationError | ||
|
||
if TYPE_CHECKING: | ||
from pymongo.pyopenssl_context import SSLContext | ||
from pymongo.typings import _AgnosticMongoClient, _DocumentTypeArg | ||
|
||
|
||
|
@@ -236,9 +239,21 @@ def __init__( | |
self._mongocryptd_spawn_args.append("--idleShutdownTimeoutSecs=60") | ||
# Maps KMS provider name to a SSLContext. | ||
self._kms_tls_options = kms_tls_options | ||
self._sync_kms_ssl_contexts: dict[str, SSLContext] = None # type:ignore[assignment] | ||
self._async_kms_ssl_contexts: dict[str, SSLContext] = None # type:ignore[assignment] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and fixed |
||
self._bypass_query_analysis = bypass_query_analysis | ||
self._key_expiration_ms = key_expiration_ms | ||
|
||
def _kms_ssl_contexts(self, is_sync: bool) -> dict[str, SSLContext]: | ||
if is_sync: | ||
if self._sync_kms_ssl_contexts is None: | ||
self._sync_kms_ssl_contexts = _parse_kms_tls_options(self._kms_tls_options, True) | ||
return self._sync_kms_ssl_contexts | ||
else: | ||
if self._async_kms_ssl_contexts is None: | ||
self._async_kms_ssl_contexts = _parse_kms_tls_options(self._kms_tls_options, False) | ||
return self._async_kms_ssl_contexts | ||
|
||
|
||
class RangeOpts: | ||
"""Options to configure encrypted queries using the range algorithm.""" | ||
|
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's worth adding a comment here to explain that we call this here so that parsing errors can be raised before creating internal clients.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense, added :)