Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
36bd1e5
INTPYTHON-527 Add Queryable Encryption support
aclark4life Jun 25, 2025
70c946b
encrypted fields map != encrypted fields
aclark4life Aug 27, 2025
cb3512c
Use dot separator
aclark4life Sep 16, 2025
46ca9dc
Refactor tests
aclark4life Sep 19, 2025
87b1dc9
Add embedding
aclark4life Sep 19, 2025
d39f3b3
Review feedback
aclark4life Sep 19, 2025
3f8b5c2
remove EncryptedEmbeddedModel
timgraham Sep 23, 2025
441c584
PatientRecord shouldn't be encrypted
timgraham Sep 23, 2025
c9cc301
fix linting of kms_provider() docstring line length
timgraham Sep 23, 2025
332decb
Code review fixes
aclark4life Sep 30, 2025
0317fba
Use EncryptionTestCase instead of TestCase
aclark4life Oct 2, 2025
e3da2f6
make atlas tests use encryption settings
timgraham Oct 2, 2025
fe790c7
try shared library
timgraham Oct 3, 2025
2270058
try ubuntu 22.04 just to be sure
timgraham Oct 3, 2025
e38b496
Code review fixes
aclark4life Oct 3, 2025
36c6bfd
Update QE guide with complete Python tutorial
aclark4life Oct 3, 2025
86486eb
update version added to 5.2.2
aclark4life Oct 3, 2025
59865f7
Add tests for EncryptedFieldMixin
aclark4life Oct 3, 2025
fc87e9f
Remove confusing paragraph about crypt shared
aclark4life Oct 3, 2025
75873e9
Target 5.2.3 for release and require MongoDB 8
aclark4life Oct 3, 2025
324c959
try Mongo 8.0.15 on CI
timgraham Oct 3, 2025
13ed19a
Misc updates
aclark4life Oct 4, 2025
b23c4f2
Misc updates
aclark4life Oct 6, 2025
a0cd197
Kill the helper
aclark4life Oct 7, 2025
65b96b2
Misc updates
aclark4life Oct 8, 2025
80881fa
Add assertEncrypted to verify field data is binary
aclark4life Oct 9, 2025
25e7da1
Fails on CI only
aclark4life Oct 9, 2025
f67b819
DEBUG
aclark4life Oct 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .evergreen/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set -eux
/opt/python/3.10/bin/python3 -m venv venv
. venv/bin/activate
python -m pip install -U pip
pip install ".[encryption]"
pip install -e .

# Install django and test dependencies
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/encrypted_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import os

from mongodb_settings import * # noqa: F403
from pymongo.encryption import AutoEncryptionOpts

DATABASES["encrypted"] = { # noqa: F405
"ENGINE": "django_mongodb_backend",
"NAME": "djangotests-encrypted",
"OPTIONS": {
"auto_encryption_opts": AutoEncryptionOpts(
key_vault_namespace="my_encrypted_database.keyvault",
kms_providers={"local": {"key": os.urandom(96)}},
# crypt_shared_lib_path="lib/mongo_crypt_v1.so",
),
"directConnection": True,
},
"KMS_CREDENTIALS": {},
}
19 changes: 19 additions & 0 deletions .github/workflows/mongodb_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
DATABASES = {
"default": {**db_settings, "NAME": "djangotests"},
"other": {**db_settings, "NAME": "djangotests-other"},
"encrypted": {},
}
else:
DATABASES = {
Expand All @@ -28,8 +29,26 @@
"NAME": "djangotests-other",
"OPTIONS": {"directConnection": True},
},
"encrypted": {},
}


class EncryptedRouter:
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

def kms_provider(self, model, **hints):
return "local"


DATABASE_ROUTERS = [EncryptedRouter()]
DEFAULT_AUTO_FIELD = "django_mongodb_backend.fields.ObjectIdAutoField"
PASSWORD_HASHERS = ("django.contrib.auth.hashers.MD5PasswordHasher",)
SECRET_KEY = "django_tests_secret_key"
Expand Down
Loading
Loading