PYTHON-5677 Prevent ClientEncryption from loading crypt shared library (#2659)

Co-authored-by: Kevin Albertson <kevin.albertson@mongodb.com>
This commit is contained in:
Jeffrey A. Clark 2025-12-29 17:16:34 -05:00 committed by GitHub
parent 0cd9763423
commit fdb1f7ea4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 2 deletions

View File

@ -17,6 +17,9 @@ PyMongo 4.16 brings a number of changes including:
- Fixed return type annotation for ``find_one_and_*`` methods on :class:`~pymongo.asynchronous.collection.AsyncCollection`
and :class:`~pymongo.synchronous.collection.Collection` to include ``None``.
- Added support for NumPy 1D-arrays in :class:`bson.binary.BinaryVector`.
- Prevented :class:`~pymongo.encryption.ClientEncryption` from loading the crypt
shared library to fix "MongoCryptError: An existing crypt_shared library is
loaded by the application" unless the linked library search path is set.
Changes in Version 4.15.5 (2025/12/02)
--------------------------------------

View File

@ -717,7 +717,10 @@ class AsyncClientEncryption(Generic[_DocumentType]):
self._encryption = AsyncExplicitEncrypter(
self._io_callbacks,
_create_mongocrypt_options(
kms_providers=kms_providers, schema_map=None, key_expiration_ms=key_expiration_ms
kms_providers=kms_providers,
schema_map=None,
key_expiration_ms=key_expiration_ms,
bypass_encryption=True, # Don't load crypt_shared
),
)
# Use the same key vault collection as the callback.

View File

@ -710,7 +710,10 @@ class ClientEncryption(Generic[_DocumentType]):
self._encryption = ExplicitEncrypter(
self._io_callbacks,
_create_mongocrypt_options(
kms_providers=kms_providers, schema_map=None, key_expiration_ms=key_expiration_ms
kms_providers=kms_providers,
schema_map=None,
key_expiration_ms=key_expiration_ms,
bypass_encryption=True, # Don't load crypt_shared
),
)
# Use the same key vault collection as the callback.