-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Support text indexes with encryption #1797
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
Conversation
13f5c5d
to
7832e76
Compare
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.
This is now part of the Spec and ensures that fresh encryption collections are made. This ensures __safeContent__
values are predictable and testable.
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.
Allows the crypt shared library to be set in the env.
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.
This is a change in the schema - csfle
can be either: true or a document setting the minLibmongocryptVersion
.
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.
This is a bit awkward as previously the awsTemporary
was used when a session token was provided. So I'll check and see if this should be preferred in the unified version of awsTemporary.yml
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.
sessionToken
values should be left as a string and not converted to bytes[]
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.
Although this hasn't been needed so far. It makes sense to check for an error state and handle if its ever flagged.
I noticed other language implementations do this check.
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 changes here are 99% refactorings, to dry up the code. This was done with the help of copilot when trying to debug some errors. I also added documentation to aid us devs when coming back to this code after a long time.
The real addition / change is the use of the mongocrypt_ctx_setopt_algorithm_text
step for textPreview
.
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.
This is the behavioral change - adds text options when using textPreview
.
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 spec expects libmongocrypt to report errors. So this removes our custom error reporting. A test was updated to reflect 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.
Now this test actually reflects the test name: testRangePreviewAlgorithmIsNotSupported
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.
Pull Request Overview
This PR adds support for text indexes with encryption by implementing the TextPreview algorithm for queryable encryption. It includes comprehensive changes to support prefix, suffix, and substring search operations on encrypted text fields.
- Added TextOptions class to define text search parameters (case sensitivity, diacritic sensitivity, and query length limits)
- Extended MongoExplicitEncryptOptions to support text-specific configuration
- Updated encryption validation logic and native library version requirements
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
driver-core/src/main/com/mongodb/client/model/vault/TextOptions.java | New TextOptions class for configuring text encryption parameters |
driver-core/src/main/com/mongodb/client/model/vault/EncryptOptions.java | Added textOptions field and updated documentation for TextPreview algorithm |
mongodb-crypt/src/main/com/mongodb/internal/crypt/capi/MongoExplicitEncryptOptions.java | Added textOptions support and removed validation restrictions |
mongodb-crypt/src/main/com/mongodb/internal/crypt/capi/MongoCryptImpl.java | Refactored binary handling and added text algorithm configuration |
driver-sync/src/test/functional/com/mongodb/client/AbstractClientEncryptionTextExplicitEncryptionTest.java | Comprehensive test suite for text encryption functionality |
mongodb-crypt/build.gradle.kts | Updated libmongocrypt version to 1.15.1 |
driver-core/src/test/resources/specifications | Updated specifications submodule |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
mongodb-crypt/src/main/com/mongodb/internal/crypt/capi/MongoExplicitEncryptOptions.java
Show resolved
Hide resolved
mongodb-crypt/src/main/com/mongodb/internal/crypt/capi/MongoCryptImpl.java
Outdated
Show resolved
Hide resolved
mongodb-crypt/src/main/com/mongodb/internal/crypt/capi/MongoCryptImpl.java
Outdated
Show resolved
Hide resolved
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.
LGTM, minor stuff 👍
...c/test/functional/com/mongodb/client/AbstractClientEncryptionTextExplicitEncryptionTest.java
Outdated
Show resolved
Hide resolved
...c/test/functional/com/mongodb/client/AbstractClientEncryptionTextExplicitEncryptionTest.java
Show resolved
Hide resolved
...c/test/functional/com/mongodb/client/AbstractClientEncryptionTextExplicitEncryptionTest.java
Show resolved
Hide resolved
JAVA-5851 JAVA-5903 JAVA-5924
...yptImpl.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
...yptImpl.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
beaa57b
to
5764462
Compare
Uh oh!
There was an error while loading. Please reload this page.
Added TextPreview support for Prefix/Suffix/Substring Indexes
JAVA-5851
JAVA-5903
JAVA-5924