-
Notifications
You must be signed in to change notification settings - Fork 30
INTPYTHON-527 Add Queryable Encryption support #329
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
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
django_mongodb_backend/management/commands/get_encrypted_fields_map.py
Outdated
Show resolved
Hide resolved
django_mongodb_backend/management/commands/get_encrypted_fields_map.py
Outdated
Show resolved
Hide resolved
django_mongodb_backend/management/commands/get_encrypted_fields_map.py
Outdated
Show resolved
Hide resolved
django_mongodb_backend/management/commands/get_encrypted_fields_map.py
Outdated
Show resolved
Hide resolved
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
7cfe63c to
74feef6
Compare
ec1fe5c to
cb555b5
Compare
6dc9766 to
c1cfc25
Compare
0f84103 to
ac265ce
Compare
docs/howto/queryable-encryption.rst
Outdated
| .. admonition:: Dynamic library path configuration | ||
|
|
||
| You may also need to configure an environment variable so that your system | ||
| can locate the library: |
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.
Can we be clear about the fact that this is a bug workaround and not expected behavior?
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.
Yes, I think it should say something like, "If you encounter Pymongocrypt.errors.MongoCryptError: An existing crypt_shared library is loaded by the application at [/path/to/mongo_crypt_v1.so], but the current call to mongocrypt_init() failed to find that same library.", ....
Did you find the root cause so we can at least a link to that issue in a comment here?
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.
I think the root cause is that the error message is confusing and I don't think setting environment variables is a bug workaround … rather, it's quite common when the shared library is not in the location the OS checks by default. In these cases, my guess is that the failure to find the library is because it's not found, not that there is a 2nd conflicting library, so I think the pymongocrypt error message could be improved to help with this.
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.
I'm not sure how all the parts fit together, but as far as I tested, the error doesn't happen with MongoDB 7.0 so it seems plausible it could be a server regression.
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.
@timgraham Can you reproduce with 7?
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.
The problems seems specific with version 8.0.x and later of the shared library.
No issue with MongoDB 7.0.25 + mongo_crypt_shared_v1-linux-x86_64-enterprise-ubuntu2204-7.0.25 (I'm the ubuntu2204 shared library on Ubuntu 24.04 because one isn't available for 2404).
With MongoDB 7.0.25 and 8.0.15 and mongo_crypt_shared_v1-linux-x86_64-enterprise-ubuntu2404-8.0.15: "An existing crypt_shared library is loaded... " error. [fixed by specifying LD_LIBRARY_PATH]
With MongoDB 8.0.15 + mongo_crypt_shared_v1-linux-x86_64-enterprise-ubuntu2204-7.0.25, the application starts and runs, failing later (as expected) because of backward incompatible changes to queries: "csfle "analyze_query" failed: Enumeration value 'range' for field 'create.encryptedFields.fields.queryType' is not a valid value."
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.
With MongoDB 8.0.15 + mongo_crypt_shared_v1-linux-x86_64-enterprise-ubuntu2204-7.0.25, the application starts and runs, failing later (as expected) because of backward incompatible changes to queries: "csfle "analyze_query" failed: Enumeration value 'range' for field 'create.encryptedFields.fields.queryType' is not a valid value."
Ah OK so the server should catch the missing LD_LIBRARY_PATH and say "An existing crypt_shared library is loaded... " rather than proceeding as if the library was found. Additionally the error appears nonsensical since range is correct for 8.0.
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.
No, I believe the shared library 7 loads fine, even with server 8. The error message is because shared library 7 incompatible with server 8 because shared library 7 assumes it's used with server 7 and has enumeration values like "rangePreview" built-in.
58dd814 to
301e1b4
Compare
cd6676d to
598d002
Compare
Previous attempts and additional context here:
INTPYTHON-527 Add Queryable Encryption config #318
INTPYTHON-527 Add queryable encryption support #319
INTPYTHON-527 Add Queryable Encryption support #323
Add test for "Encrypted fields found" error (ensure this exception still happens)
Add check for model schema not matching encrypted fields
Document key_vault_namespace must be encrypted db
Document that fields within EmbeddedModelArrayField can't be encrypted
Document workflow: