-
Notifications
You must be signed in to change notification settings - Fork 531
RUBY-3773 Allow keyAltName in encrypted fields map #3056
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
jamis
wants to merge
5
commits into
mongodb:master
Choose a base branch
from
jamis:3773-keyAltName-in-encryptedFieldsMap
base: master
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.
+280
−10
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6f27e31
RUBY-3773 support for keyAltName
jamis 5d646d9
Merge branch 'master' into 3773-keyAltName-in-encryptedFieldsMap
jamis debdc20
bump libmongocrypt-helper gem to 1.19.0
jamis 65f33d5
consume autoEncryptOpts in unified test runner
jamis b26ea3a
copilot feedback
jamis 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
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
249 changes: 249 additions & 0 deletions
249
spec/spec_tests/data/client_side_encryption/unified/fle2v2-InsertFind-keyAltName.yml
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,249 @@ | ||
| description: fle2v2-InsertFind-keyAltName | ||
| schemaVersion: "1.25" | ||
| runOnRequirements: | ||
| - minServerVersion: "7.0.0" | ||
| # Skip QEv2 (also referred to as FLE2v2) tests on Serverless. Unskip once Serverless enables the QEv2 protocol. | ||
| # FLE 2 Encrypted collections are not supported on standalone. | ||
| topologies: ["replicaset", "sharded", "load-balanced"] | ||
| csfle: | ||
| minLibmongocryptVersion: "1.18.0" | ||
| createEntities: | ||
| - client: | ||
| id: "client0" | ||
| autoEncryptOpts: | ||
| keyVaultNamespace: keyvault.datakeys | ||
| kmsProviders: | ||
| local: | ||
| key: Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk | ||
| encryptedFieldsMap: | ||
| default.default: | ||
| { | ||
| "fields": | ||
| [ | ||
| { | ||
| "path": "encryptedIndexed", | ||
| "bsonType": "string", | ||
| "queries": { "queryType": "equality", "contention": { "$numberLong": "0" } }, | ||
| "keyAltName": "altname" | ||
| }, | ||
| ], | ||
| } | ||
| observeEvents: | ||
| - commandStartedEvent | ||
| - database: | ||
| id: "db" | ||
| client: "client0" | ||
| databaseName: default | ||
| - collection: | ||
| id: "coll" | ||
| database: "db" | ||
| collectionName: &collection_name default | ||
| - client: | ||
| id: "client_unencrypted" | ||
| observeEvents: | ||
| - commandStartedEvent | ||
| - database: | ||
| id: "db_unencrypted" | ||
| client: "client_unencrypted" | ||
| databaseName: default | ||
| - collection: | ||
| id: "coll_unencrypted" | ||
| database: "db_unencrypted" | ||
| collectionName: default | ||
| initialData: | ||
| - databaseName: default | ||
| collectionName: default | ||
| documents: [] | ||
| createOptions: | ||
| encryptedFields: | ||
| &encrypted_fields { | ||
| "fields": | ||
| [ | ||
| { | ||
| "keyId": { "$binary": { "base64": "EjRWeBI0mHYSNBI0VniQEg==", "subType": "04" } }, | ||
| "path": "encryptedIndexed", | ||
| "bsonType": "string", | ||
| "queries": { "queryType": "equality", "contention": { "$numberLong": "0" } }, | ||
| } | ||
| ], | ||
| } | ||
| - databaseName: keyvault | ||
| collectionName: datakeys | ||
| documents: | ||
| [ | ||
| { | ||
| "_id": { "$binary": { "base64": "EjRWeBI0mHYSNBI0VniQEg==", "subType": "04" } }, | ||
| "keyMaterial": | ||
| { | ||
| "$binary": | ||
| { | ||
| "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", | ||
| "subType": "00", | ||
| }, | ||
| }, | ||
| "creationDate": { "$date": { "$numberLong": "1648914851981" } }, | ||
| "updateDate": { "$date": { "$numberLong": "1648914851981" } }, | ||
| "status": { "$numberInt": "0" }, | ||
| "masterKey": { "provider": "local" }, | ||
| "keyAltNames": ["altname"], | ||
| }, | ||
| ] | ||
| tests: | ||
| - description: "Insert and find FLE2 indexed field" | ||
| operations: | ||
| - name: insertOne | ||
| arguments: | ||
| document: &doc0 { _id: 1, encryptedIndexed: "123" } | ||
| object: "coll" | ||
| - name: find | ||
| arguments: | ||
| filter: { encryptedIndexed: "123" } | ||
| object: "coll" | ||
| expectResult: [*doc0] | ||
| - name: find | ||
| object: coll_unencrypted | ||
| arguments: | ||
| filter: {} | ||
| expectResult: | ||
| - { | ||
| "_id": 1, | ||
| "encryptedIndexed": { $$type: "binData" }, | ||
| "__safeContent__": | ||
| ["$binary": { "base64": "31eCYlbQoVboc5zwC8IoyJVSkag9PxREka8dkmbXJeY=", "subType": "00" }], | ||
| } | ||
| expectEvents: | ||
| - client: "client0" | ||
| events: | ||
| - commandStartedEvent: | ||
| command: | ||
| find: datakeys | ||
| filter: | ||
| { | ||
| "$or": | ||
| [ | ||
| "_id": { "$in": [] }, | ||
| "keyAltNames": { "$in": ["altname"] }, | ||
| ], | ||
| } | ||
| $db: keyvault | ||
| readConcern: { level: "majority" } | ||
| commandName: find | ||
| - commandStartedEvent: | ||
| command: | ||
| insert: *collection_name | ||
| documents: | ||
| - { "_id": 1, "encryptedIndexed": { $$type: "binData" } } | ||
| ordered: true | ||
| encryptionInformation: | ||
| type: 1 | ||
| schema: | ||
| default.default: | ||
| # libmongocrypt applies escCollection and ecocCollection to outgoing command. | ||
| escCollection: "enxcol_.default.esc" | ||
| ecocCollection: "enxcol_.default.ecoc" | ||
| <<: *encrypted_fields | ||
| commandName: insert | ||
| - commandStartedEvent: | ||
| command: | ||
| find: *collection_name | ||
| filter: | ||
| { | ||
| "encryptedIndexed": | ||
| { | ||
| "$eq": | ||
| { | ||
| "$binary": | ||
| { | ||
| "base64": "DIkAAAAFZAAgAAAAAPGmZcUzdE/FPILvRSyAScGvZparGI2y9rJ/vSBxgCujBXMAIAAAAACi1RjmndKqgnXy7xb22RzUbnZl1sOZRXPOC0KcJkAxmQVsACAAAAAApJtKPW4+o9B7gAynNLL26jtlB4+hq5TXResijcYet8USY20AAAAAAAAAAAAA", | ||
| "subType": "06", | ||
| }, | ||
| }, | ||
| }, | ||
| } | ||
| encryptionInformation: | ||
| type: 1 | ||
| schema: | ||
| default.default: | ||
| # libmongocrypt applies escCollection and ecocCollection to outgoing command. | ||
| escCollection: "enxcol_.default.esc" | ||
| ecocCollection: "enxcol_.default.ecoc" | ||
| <<: *encrypted_fields | ||
| commandName: find | ||
| - description: "Create translates keyAltName" | ||
| operations: | ||
| - name: dropCollection # Drop collection if already exists | ||
| object: "db" | ||
| arguments: | ||
| collection: *collection_name | ||
| - name: createCollection # Uses encrypted client with encryptedFieldsMap. keyAltName translated to keyId. | ||
| object: "db" | ||
| arguments: | ||
| collection: *collection_name | ||
| expectEvents: | ||
| - client: "client0" | ||
| events: | ||
|
|
||
| # events from dropCollection ... begin | ||
| - commandStartedEvent: | ||
| command: | ||
| drop: &esc_collection_name enxcol_.default.esc | ||
| commandName: drop | ||
| - commandStartedEvent: | ||
| command: | ||
| drop: &ecoc_collection_name enxcol_.default.ecoc | ||
| commandName: drop | ||
| - commandStartedEvent: | ||
| command: | ||
| drop: *collection_name | ||
| commandName: drop | ||
| # events from dropCollection ... end | ||
|
|
||
| # events from createCollection ... begin | ||
| - commandStartedEvent: | ||
| command: | ||
| create: *esc_collection_name | ||
| clusteredIndex: {key: {_id: 1}, unique: true} | ||
| commandName: create | ||
| - commandStartedEvent: | ||
| command: | ||
| create: *ecoc_collection_name | ||
| clusteredIndex: {key: {_id: 1}, unique: true} | ||
| commandName: create | ||
| - commandStartedEvent: | ||
| command: | ||
| find: datakeys # To translate keyAltName to keyId. | ||
| filter: | ||
| { | ||
| "$or": | ||
| [ | ||
| "_id": { "$in": [] }, | ||
| "keyAltNames": { "$in": ["altname"] }, | ||
| ], | ||
| } | ||
| $db: keyvault | ||
| readConcern: { level: "majority" } | ||
| commandName: find | ||
| - commandStartedEvent: | ||
| command: | ||
| create: *collection_name | ||
| encryptedFields: &encryptedFields_translated { | ||
| "fields": | ||
| [ | ||
| { | ||
| "path": "encryptedIndexed", | ||
| "bsonType": "string", | ||
| "queries": { "queryType": "equality", "contention": { "$numberLong": "0" } }, | ||
| "keyId": { "$binary": { "base64": "EjRWeBI0mHYSNBI0VniQEg==", "subType": "04" } } | ||
| } | ||
| ] | ||
| } | ||
| commandName: create | ||
| # Index on __safeContents__ is then created. | ||
| - commandStartedEvent: | ||
| command: | ||
| createIndexes: *collection_name | ||
| indexes: | ||
| - name: __safeContent___1 | ||
| key: { __safeContent__: 1 } | ||
| commandName: createIndexes | ||
| # events from createCollection ... end | ||
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.