-
Notifications
You must be signed in to change notification settings - Fork 31
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
Open
aclark4life
wants to merge
24
commits into
mongodb:main
Choose a base branch
from
aclark4life:INTPYTHON-527
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
95fc8dd
[temp] remove Django tests for faster CI
timgraham 3e4e244
INTPYTHON-527 Add Queryable Encryption support
aclark4life d4a555c
use shared library instead of mongocryptd
timgraham 6e53f6d
polish howto
timgraham b5a02cd
doc query limitations + docs polish + todos
timgraham f33d0a4
edit "Dynamic library path configuration"
timgraham b1ad80e
combine topic guide with howto
timgraham 7404fa9
Add "start csfle servers" func to evergreen config
aclark4life 6fc5f8d
remove support for multiple kms providers
timgraham c4bb896
Add tests-8-qe to evergreen buildvariants
aclark4life abe29b7
fix less than lookup on encrypted fields
timgraham c157f04
simplify "Configuring the Automatic Encryption Shared Library" to rem…
timgraham 483784f
reorder "Configuring the Automatic Encryption Shared Library" to make…
timgraham 8fcc3c3
update docs/tests for $facet removal
timgraham aaa3d4f
Combine crypt shared w/installation & db setup
aclark4life 6ebc3a8
Update versionadded to 6.0.1
aclark4life e9a748c
Configure AWS KMS for testing on evergreen
aclark4life 10014f4
doc edits
aclark4life 1caf632
Address review
aclark4life be1d3cb
Address UAT feedback
aclark4life 417f1ef
Address UAT feedback
aclark4life 070c2a6
add encryption-compatible aggregation wrap
timgraham 47e064f
remove KMS_CREDENTIALS for "local" provider
timgraham 2e87e1d
Relax "cannot aggregate encrypted fields" error message, possibly for…
timgraham 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
Some comments aren't visible on the classic Files Changed page.
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
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 |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| from local_kms_encrypted_settings import * # noqa: F403 | ||
|
|
||
| DATABASES["encrypted"] = { # noqa: F405 | ||
| "ENGINE": "django_mongodb_backend", | ||
| "NAME": "djangotests_encrypted", | ||
| "OPTIONS": { | ||
| "auto_encryption_opts": AutoEncryptionOpts( # noqa: F405 | ||
| key_vault_namespace="djangotests_encrypted.__keyVault", | ||
| kms_providers={ | ||
| "aws": { | ||
| "accessKeyId": os.environ.get("FLE_AWS_KEY"), # noqa: F405 | ||
| "secretAccessKey": os.environ.get("FLE_AWS_SECRET"), # noqa: F405 | ||
| } | ||
| }, | ||
| crypt_shared_lib_path=os.environ["CRYPT_SHARED_LIB_PATH"], # noqa: F405 | ||
| crypt_shared_lib_required=True, | ||
| ), | ||
| "directConnection": True, | ||
| }, | ||
| "KMS_CREDENTIALS": { | ||
| "aws": { | ||
| "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", | ||
| "region": "us-east-1", | ||
| } | ||
| }, | ||
| } |
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 |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Settings for django_mongodb_backend/tests when encryption is supported. | ||
| import os | ||
| from pathlib import Path | ||
|
|
||
| from mongodb_settings import * # noqa: F403 | ||
| from pymongo.encryption import AutoEncryptionOpts | ||
|
|
||
| os.environ["LD_LIBRARY_PATH"] = str(Path(os.environ["CRYPT_SHARED_LIB_PATH"]).parent) | ||
|
|
||
| DATABASES["encrypted"] = { # noqa: F405 | ||
| "ENGINE": "django_mongodb_backend", | ||
| "NAME": "djangotests_encrypted", | ||
| "OPTIONS": { | ||
| "auto_encryption_opts": AutoEncryptionOpts( | ||
| key_vault_namespace="djangotests_encrypted.__keyVault", | ||
| kms_providers={"local": {"key": os.urandom(96)}}, | ||
| crypt_shared_lib_path=os.environ["CRYPT_SHARED_LIB_PATH"], | ||
| ), | ||
| "directConnection": True, | ||
| }, | ||
| } | ||
|
|
||
|
|
||
| class EncryptedRouter: | ||
| def db_for_read(self, model, **hints): | ||
| if model._meta.app_label == "encryption_": | ||
| return "encrypted" | ||
| return None | ||
|
|
||
| db_for_write = db_for_read | ||
|
|
||
| def allow_migrate(self, db, app_label, model_name=None, **hints): | ||
| # The encryption_ app's models are only created in the encrypted | ||
| # database. | ||
| if app_label == "encryption_": | ||
| return db == "encrypted" | ||
| # Don't create other app's models in the encrypted database. | ||
| if db == "encrypted": | ||
| return False | ||
| return None | ||
|
|
||
|
|
||
| DATABASE_ROUTERS.append(EncryptedRouter()) # noqa: F405 |
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 |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| # Settings for django_mongodb_backend/tests. | ||
| from django_settings import * # noqa: F403 | ||
|
|
||
| DATABASES["encrypted"] = {} # noqa: F405 | ||
| DATABASE_ROUTERS = ["django_mongodb_backend.routers.MongoRouter"] |
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
My impression is that we only want to test with dot zero MongoDB's, but lets get clarification on 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.
If we use 8 then we get this:
Presumably because mongo-orchestration installs the corresponding crypt shared version to match the server version. We could
--skip-crypt-sharedand manually install crypt shared 8.2 similar to what is in GitHub Actions, but I'm not sure if it's worth the effort.