Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion src/client-side-encryption/auto_encrypter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,6 @@ export class AutoEncrypter {
}

const commandBuffer = Buffer.isBuffer(cmd) ? cmd : serialize(cmd, options);

const context = this._mongocrypt.makeEncryptionContext(
MongoDBCollectionNamespace.fromString(ns).db,
commandBuffer
Expand Down
3 changes: 2 additions & 1 deletion test/integration/change-streams/change_stream.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import {
type ResumeToken
} from '../../mongodb';
import * as mock from '../../tools/mongodb-mock/index';
import { type FailPoint, sleep, TestBuilder, UnifiedTestSuiteBuilder } from '../../tools/utils';
import { TestBuilder, UnifiedTestSuiteBuilder } from '../../tools/unified_suite_builder';
import { type FailPoint, sleep } from '../../tools/utils';
import { delay, filterForCommands } from '../shared';

const initIteratorMode = async (cs: ChangeStream) => {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/enumerate_collections.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TestBuilder, UnifiedTestSuiteBuilder } from '../tools/utils';
import { TestBuilder, UnifiedTestSuiteBuilder } from '../tools/unified_suite_builder';

describe('listCollections', () => {
UnifiedTestSuiteBuilder.describe('comment option')
Expand Down
2 changes: 1 addition & 1 deletion test/integration/enumerate_databases.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from 'chai';
import { once } from 'events';

import { type MongoClient, MongoServerError } from '../mongodb';
import { TestBuilder, UnifiedTestSuiteBuilder } from '../tools/utils';
import { TestBuilder, UnifiedTestSuiteBuilder } from '../tools/unified_suite_builder';

const metadata: MongoDBMetadataUI = {
requires: {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/enumerate_indexes.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TestBuilder, UnifiedTestSuiteBuilder } from '../tools/utils';
import { TestBuilder, UnifiedTestSuiteBuilder } from '../tools/unified_suite_builder';

describe('listIndexes()', () => {
UnifiedTestSuiteBuilder.describe('comment option')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai';

import { type Collection, type CommandStartedEvent, Long, type MongoClient } from '../../mongodb';
import { TestBuilder, UnifiedTestSuiteBuilder } from '../../tools/utils';
import { TestBuilder, UnifiedTestSuiteBuilder } from '../../tools/unified_suite_builder';

const falsyValues = [0, false, '', Long.ZERO, null, NaN] as const;
const falsyToString = (value: (typeof falsyValues)[number]) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { type FailPoint, TestBuilder, UnifiedTestSuiteBuilder } from '../../tools/utils';
import {
type FailPoint,
TestBuilder,
UnifiedTestSuiteBuilder
} from '../../tools/unified_suite_builder';

describe('Unified Test Runner', () => {
UnifiedTestSuiteBuilder.describe('withTransaction error propagation')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,322 @@
{
"description": "fle2v2-BypassQueryAnalysis",
"schemaVersion": "1.23",
"runOnRequirements": [
{
"minServerVersion": "7.0.0",
"serverless": "forbid",
"csfle": true,
"topologies": [
"replicaset",
"sharded",
"load-balanced"
]
}
],
"createEntities": [
{
"client": {
"id": "client0",
"autoEncryptOpts": {
"kmsProviders": {
"local": {
"key": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk"
}
},
"keyVaultNamespace": "keyvault.datakeys",
"bypassQueryAnalysis": true
},
"observeEvents": [
"commandStartedEvent"
]
}
},
{
"database": {
"id": "encryptedDB",
"client": "client0",
"databaseName": "default"
}
},
{
"collection": {
"id": "encryptedColl",
"database": "encryptedDB",
"collectionName": "default"
}
},
{
"client": {
"id": "client1"
}
},
{
"database": {
"id": "unencryptedDB",
"client": "client1",
"databaseName": "default"
}
},
{
"collection": {
"id": "unencryptedColl",
"database": "unencryptedDB",
"collectionName": "default"
}
}
],
"initialData": [
{
"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"
}
}
]
},
{
"databaseName": "default",
"collectionName": "default",
"documents": [],
"createOptions": {
"encryptedFields": {
"fields": [
{
"keyId": {
"$binary": {
"base64": "EjRWeBI0mHYSNBI0VniQEg==",
"subType": "04"
}
},
"path": "encryptedIndexed",
"bsonType": "string",
"queries": {
"queryType": "equality",
"contention": {
"$numberLong": "0"
}
}
},
{
"keyId": {
"$binary": {
"base64": "q83vqxI0mHYSNBI0VniQEg==",
"subType": "04"
}
},
"path": "encryptedUnindexed",
"bsonType": "string"
}
]
}
}
}
],
"tests": [
{
"description": "BypassQueryAnalysis decrypts",
"operations": [
{
"object": "encryptedColl",
"name": "insertOne",
"arguments": {
"document": {
"_id": 1,
"encryptedIndexed": {
"$binary": {
"base64": "C18BAAAFZAAgAAAAANnt+eLTkv4GdDPl8IAfJOvTzArOgFJQ2S/DcLza4W0DBXMAIAAAAAD2u+omZme3P2gBPehMQyQHQ153tPN1+z7bksYA9jKTpAVwADAAAAAAUnCOQqIvmR65YKyYnsiVfVrg9hwUVO3RhhKExo3RWOzgaS0QdsBL5xKFS0JhZSoWBXUAEAAAAAQSNFZ4EjSYdhI0EjRWeJASEHQAAgAAAAV2AFAAAAAAEjRWeBI0mHYSNBI0VniQEpQbp/ZJpWBKeDtKLiXb0P2E9wvc0g3f373jnYQYlJquOrlPOoEy3ngsHPJuSUijvWDsrQzqYa349K7G/66qaXEFZQAgAAAAAOuac/eRLYakKX6B0vZ1r3QodOQFfjqJD+xlGiPu4/PsBWwAIAAAAACkm0o9bj6j0HuADKc0svbqO2UHj6GrlNdF6yKNxh63xRJrAAAAAAAAAAAAAA==",
"subType": "06"
}
}
}
}
},
{
"object": "encryptedColl",
"name": "find",
"arguments": {
"filter": {
"_id": 1
}
},
"expectResult": [
{
"_id": 1,
"encryptedIndexed": "123"
}
]
},
{
"object": "unencryptedColl",
"name": "find",
"arguments": {
"filter": {}
},
"expectResult": [
{
"_id": 1,
"encryptedIndexed": {
"$$type": "binData"
},
"__safeContent__": [
{
"$binary": {
"base64": "31eCYlbQoVboc5zwC8IoyJVSkag9PxREka8dkmbXJeY=",
"subType": "00"
}
}
]
}
]
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"listCollections": 1,
"filter": {
"name": "default"
}
},
"commandName": "listCollections"
}
},
{
"commandStartedEvent": {
"command": {
"insert": "default",
"documents": [
{
"_id": 1,
"encryptedIndexed": {
"$binary": {
"base64": "C18BAAAFZAAgAAAAANnt+eLTkv4GdDPl8IAfJOvTzArOgFJQ2S/DcLza4W0DBXMAIAAAAAD2u+omZme3P2gBPehMQyQHQ153tPN1+z7bksYA9jKTpAVwADAAAAAAUnCOQqIvmR65YKyYnsiVfVrg9hwUVO3RhhKExo3RWOzgaS0QdsBL5xKFS0JhZSoWBXUAEAAAAAQSNFZ4EjSYdhI0EjRWeJASEHQAAgAAAAV2AFAAAAAAEjRWeBI0mHYSNBI0VniQEpQbp/ZJpWBKeDtKLiXb0P2E9wvc0g3f373jnYQYlJquOrlPOoEy3ngsHPJuSUijvWDsrQzqYa349K7G/66qaXEFZQAgAAAAAOuac/eRLYakKX6B0vZ1r3QodOQFfjqJD+xlGiPu4/PsBWwAIAAAAACkm0o9bj6j0HuADKc0svbqO2UHj6GrlNdF6yKNxh63xRJrAAAAAAAAAAAAAA==",
"subType": "06"
}
}
}
],
"ordered": true,
"encryptionInformation": {
"type": 1,
"schema": {
"default.default": {
"escCollection": "enxcol_.default.esc",
"ecocCollection": "enxcol_.default.ecoc",
"fields": [
{
"keyId": {
"$binary": {
"base64": "EjRWeBI0mHYSNBI0VniQEg==",
"subType": "04"
}
},
"path": "encryptedIndexed",
"bsonType": "string",
"queries": {
"queryType": "equality",
"contention": {
"$numberLong": "0"
}
}
},
{
"keyId": {
"$binary": {
"base64": "q83vqxI0mHYSNBI0VniQEg==",
"subType": "04"
}
},
"path": "encryptedUnindexed",
"bsonType": "string"
}
]
}
}
}
},
"commandName": "insert"
}
},
{
"commandStartedEvent": {
"command": {
"find": "default",
"filter": {
"_id": 1
}
},
"commandName": "find"
}
},
{
"commandStartedEvent": {
"command": {
"find": "datakeys",
"filter": {
"$or": [
{
"_id": {
"$in": [
{
"$binary": {
"base64": "EjRWeBI0mHYSNBI0VniQEg==",
"subType": "04"
}
}
]
}
},
{
"keyAltNames": {
"$in": []
}
}
]
},
"$db": "keyvault",
"readConcern": {
"level": "majority"
}
},
"commandName": "find"
}
}
]
}
]
}
]
}
Loading