-
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
30
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
30 commits
Select commit
Hold shift + click to select a range
f260ecb
Remove $facet in top level group stages
WaVEV 4dcf235
Wrap query for global aggregation
WaVEV d747310
[temp] remove Django tests for faster CI
timgraham fc3915b
INTPYTHON-527 Add Queryable Encryption support
aclark4life 0e4c9ef
[wip] updates to field docs
timgraham 913e669
add QuerySet tests
timgraham f5dfa89
use shared library instead of mongocryptd
timgraham 233fa08
adjust message and add test for missing auto_encryption_opts error
timgraham 9050bd0
polish howto
timgraham 98dfa80
doc query limitations + docs polish + todos
timgraham 93737ec
edit "Dynamic library path configuration"
timgraham fc30ab2
combine topic guide with howto
timgraham 3e2ae81
Remove QE from 5.2.0 beta 2 release notes
aclark4life ce41b74
Add "start csfle servers" func to evergreen config
aclark4life 8ca71d2
remove support for multiple kms providers
timgraham a64e494
fix join tests following foreignField/localField refactor
timgraham 0f43b90
Add tests-8-qe to evergreen buildvariants
aclark4life 34b710b
fix less than lookup on encrypted fields
timgraham 8bc86ad
simplify "Configuring the Automatic Encryption Shared Library" to rem…
timgraham 20c6c9a
reorder "Configuring the Automatic Encryption Shared Library" to make…
timgraham f83c854
update docs/tests for $facet removal
timgraham 0bbb296
Combine crypt shared w/installation & db setup
aclark4life d47e067
`versionadded` updated from 5.2.3 to 6.0.0.
aclark4life 060b315
Configure AWS KMS for testing on evergreen
aclark4life ffe0b17
doc edits
aclark4life 2f73363
Address review
aclark4life 8344284
Address UAT feedback
aclark4life 08ef851
Address review
aclark4life 723a46f
Update versionadded 6.0.0 -> 6.0.1
aclark4life 78af9b4
Address UAT feedback
aclark4life 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,44 @@ | ||
| # 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, | ||
| }, | ||
| "KMS_CREDENTIALS": {"local": {}}, | ||
| } | ||
|
|
||
|
|
||
| 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.
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.