Skip to content
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

DRIVERS-2781 Add option to configure DEK cache lifetime #1730

Merged
merged 7 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
runOn:
- minServerVersion: "4.1.10"
database_name: &database_name "default"
collection_name: &collection_name "default"

data: []
json_schema: {{schema()}}
key_vault_data: [{{key()}}]

tests:
- description: "Insert with deterministic encryption, then find it"
clientOptions:
autoEncryptOpts:
kmsProviders:
aws: {} # Credentials filled in from environment.
keyExpirationMS: 1
operations:
- name: insertOne
arguments:
document: &doc0 { _id: 1, encrypted_string: "string0" }
- name: wait
object: testRunner
arguments:
ms: 2
- name: find
arguments:
filter: { _id: 1 }
result: [*doc0]
expectations:
# Auto encryption will request the collection info.
- command_started_event:
command:
listCollections: 1
filter:
name: *collection_name
command_name: listCollections
# Then key is fetched from the key vault.
- command_started_event:
command:
find: datakeys
filter: {"$or": [{"_id": {"$in": [ {{key()["_id"]}} ] }}, {"keyAltNames": {"$in": []}}]}
$db: keyvault
readConcern: { level: "majority" }
command_name: find
- command_started_event:
command:
insert: *collection_name
documents:
- &doc0_encrypted { _id: 1, encrypted_string: {{ciphertext("string0", field="encrypted_string")}} }
ordered: true
command_name: insert
- command_started_event:
command:
find: *collection_name
filter: { _id: 1 }
command_name: find
# The cache has expired and the key must be fetched again
- command_started_event:
command:
find: datakeys
filter: {"$or": [{"_id": {"$in": [ {{key()["_id"]}} ] }}, {"keyAltNames": {"$in": []}}]}
$db: keyvault
readConcern: { level: "majority" }
command_name: find
outcome:
collection:
# Outcome is checked using a separate MongoClient without auto encryption.
data:
- *doc0_encrypted
270 changes: 270 additions & 0 deletions source/client-side-encryption/tests/legacy/keyCache.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading