Skip to content

Commit 3670e0b

Browse files
kkloberdanzeramongodbkevinAlbs
authored
FLE 1.0 Shared Library (#954)
CXX-2433 CXX-2596 CXX-2608 * Test mongocryptd is not spawned when shared library is loaded * Drivers MUST run all tests with mongocryptd on at least one platform for all tested server versions (4.2+). * Drivers MUST run all tests with crypt_shared_ on at least one platform for all tested server versions (4.2+). For server versions < 6.0, drivers MUST test with the latest major release of crypt_shared_ (currently 6.0). Using the latest major release of crypt_shared_ is supported with older server versions. Co-authored-by: Ezra Chung <[email protected]> Co-authored-by: Kevin Albertson <[email protected]>
1 parent 56a0386 commit 3670e0b

File tree

3 files changed

+198
-47
lines changed

3 files changed

+198
-47
lines changed

.mci.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ functions:
164164
./src/mongocxx/test/test_mongohouse_specs
165165
166166
"start_mongod":
167-
command: shell.exec
167+
- command: shell.exec
168168
params:
169169
shell: bash
170170
working_dir: "."
@@ -198,6 +198,10 @@ functions:
198198
199199
cd ../
200200
pwd
201+
- command: expansions.update
202+
params:
203+
type: setup
204+
file: drivers-evergreen-tools/mo-expansion.yml
201205

202206

203207
"stop_mongod":
@@ -528,6 +532,15 @@ functions:
528532
529533
ulimit -c unlimited || true
530534
535+
if [ "${use_mongocryptd}" = "true" ]; then
536+
echo "Will run tests using mongocryptd (instead of crypt_shared library)"
537+
else
538+
echo "Will run tests using crypt_shared library (instead of mongocryptd)"
539+
# Set by run-orchestration.sh in "start_mongod".
540+
export CRYPT_SHARED_LIB_PATH="${CRYPT_SHARED_LIB_PATH}"
541+
echo "CRYPT_SHARED_LIB_PATH=$CRYPT_SHARED_LIB_PATH"
542+
fi
543+
531544
# Run tests and examples 1-by-1 with "test_params" so we can run them with valgrind.
532545
${test_params} ./src/bsoncxx/test/test_bson
533546
${test_params} ./src/mongocxx/test/test_driver
@@ -1174,6 +1187,19 @@ buildvariants:
11741187
- debian10-large
11751188
- name: uninstall_check
11761189

1190+
# Add matrix for specification test requirement of mongocryptd:
1191+
# "Drivers MUST run all tests with mongocryptd on at least one platform for all tested server versions (4.2+)."
1192+
- matrix_name: "mongocryptd"
1193+
matrix_spec:
1194+
os: "ubuntu-1804"
1195+
mongodb_version: ["4.2", "4.4", "5.0", "latest"]
1196+
display_name: "${os} (MongoDB ${mongodb_version}) with mongocryptd"
1197+
tasks:
1198+
- name: compile_and_test_with_shared_libs
1199+
- name: compile_and_test_with_shared_libs_replica_set
1200+
expansions:
1201+
use_mongocryptd: true
1202+
11771203
- name: ubuntu2004-release-latest
11781204
display_name: "Ubuntu 20.04 Release (MongoDB Latest)"
11791205
expansions:
@@ -1271,6 +1297,7 @@ buildvariants:
12711297
poly_flags: *poly_std_experimental_flags
12721298
mongodb_version: *version_44
12731299
example_projects_cxx_standard: *std_experimental_cxx_standard
1300+
use_mongocryptd: true # crypt_shared is not available for Ubuntu 16.04
12741301
run_on:
12751302
- ubuntu1604-build
12761303
tasks:
@@ -1289,6 +1316,7 @@ buildvariants:
12891316
test_params: *valgrind_test_params
12901317
mongodb_version: *version_latest
12911318
disable_slow_tests: 1
1319+
use_mongocryptd: true # false positives arise from the crypt_shared library
12921320
run_on:
12931321
- ubuntu1804-build
12941322
tasks:
@@ -1307,6 +1335,7 @@ buildvariants:
13071335
test_params: *valgrind_test_params
13081336
mongodb_version: *version_50
13091337
disable_slow_tests: 1
1338+
use_mongocryptd: true
13101339
run_on:
13111340
- ubuntu1804-build
13121341
tasks:

src/mongocxx/options/auto_encryption.hpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,33 @@ class MONGOCXX_API auto_encryption {
334334
/// - mongocryptdSpawnArgs: array[strings], options passed to mongocryptd
335335
/// when spawing. Defaults to ["--idleShutdownTimeoutSecs=60"].
336336
///
337+
/// - cryptSharedLibPath - Set a filepath string referring to a crypt_shared library file. Unset
338+
/// by default. If not set (the default), libmongocrypt will attempt to load crypt_shared
339+
/// using the host system’s default dynamic-library-search system.
340+
///
341+
/// If set, the given path should identify the crypt_shared dynamic library file itself, not
342+
/// the directory that contains it.
343+
///
344+
/// If the given path is a relative path and the first path component is $ORIGIN, the $ORIGIN
345+
/// component will be replaced with the absolute path to the directory containing the
346+
/// libmongocrypt library in use by the application.
347+
///
348+
/// Note No other RPATH/RUNPATH-style substitutions are available.
349+
/// If the given path is a relative path, the path will be resolved relative to the working
350+
/// directory of the operating system process.
351+
///
352+
/// If this option is set and libmongocrypt fails to load crypt_shared from the given
353+
/// filepath, libmongocrypt will fail to initialize and will not attempt to search for
354+
/// crypt_shared in any other locations.
355+
///
356+
/// - cryptSharedLibRequired - If set to true, and libmongocrypt fails to load a crypt_shared
357+
/// library, initialization of auto-encryption will fail immediately and will not attempt to
358+
/// spawn mongocryptd.
359+
///
360+
/// If set to false (the default), cryptSharedLibPath is not set, and libmongocrypt fails to
361+
/// load crypt_shared, then libmongocrypt will proceed without crypt_shared and fall back to
362+
/// using mongocryptd.
363+
///
337364
/// @param extra
338365
/// The extra options to set.
339366
///

0 commit comments

Comments
 (0)