Skip to content

Commit 2996495

Browse files
authored
chore: replace references to csfle shared library COMPASS-5859 (#3149)
1 parent a75ca53 commit 2996495

File tree

9 files changed

+45
-23
lines changed

9 files changed

+45
-23
lines changed

.evergreen/functions.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -396,11 +396,11 @@ functions:
396396
set -e
397397
# Load environment variables
398398
eval $(.evergreen/print-compass-env.sh)
399-
rm -rf mongodb-csfle && mkdir -p mongodb-csfle
400-
(cd mongodb-csfle && \
401-
curl -sSfL $(npx -y mongodb-download-url --enterprise --csfle --version '>= 6.0.0-rc1') | \
399+
rm -rf mongodb-crypt && mkdir -p mongodb-crypt
400+
(cd mongodb-crypt && \
401+
curl -sSfL $(npx -y mongodb-download-url --enterprise --crypt_shared --version '>= 6.0.0-rc1') | \
402402
tar -xvz)
403-
export COMPASS_CSFLE_LIBRARY_PATH=$(echo $PWD/mongodb-csfle/lib/mongo_csfle_v1.*)
403+
export COMPASS_CRYPT_LIBRARY_PATH=$(echo $PWD/mongodb-crypt/lib/mongo_*_v1.*)
404404
npm run test-csfle --workspace mongodb-data-service
405405
406406
save-windows-artifacts:

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ coverage
2727
.ackrc
2828
env-vars.sh
2929
mongocryptd.pid
30-
mongodb-csfle
30+
mongodb-crypt

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/compass/LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,5 +556,5 @@
556556

557557
END OF TERMS AND CONDITIONS
558558

559-
This product also includes the MongoDB Client-Side Field-Level Encryption library
560-
(mongodb_csfle_v1) which is covered by the MongoDB Enterprise Agreement.
559+
This product also includes the MongoDB Crypt library (mongodb_crypt_v1)
560+
which is covered by the MongoDB Enterprise Agreement.

packages/compass/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@
251251
"mongodb": "^4.6.0",
252252
"mongodb-connection-model": "^21.17.0",
253253
"mongodb-data-service": "^21.21.0",
254-
"mongodb-download-url": "^1.2.0",
254+
"mongodb-download-url": "^1.2.2",
255255
"mongodb-instance-model": "^11.23.0",
256256
"mongodb-log-writer": "^1.1.4",
257257
"mongodb-url": "^3.0.3",

packages/compass/scripts/download-csfle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const download = async(url, destDir) => {
6666

6767
const downloadOptions = {
6868
enterprise: true,
69-
csfle: true
69+
crypt_shared: true
7070
};
7171
if (process.platform === 'linux') {
7272
// The CSFLE shared library is built for different distros,

packages/compass/src/main/setup-csfle-library.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,28 @@ export async function setupCSFLELibrary(): Promise<void> {
2424
if (!csfleLibraryPath) {
2525
// This is not a loop so that the require() parts receive literal strings
2626
// in order for webpack to process them properly
27+
try {
28+
const candidate = processPath(require('../deps/csfle/bin/mongo_crypt_v1.dll'));
29+
await fs.access(candidate);
30+
csfleLibraryPath = candidate;
31+
} catch (err: any) {
32+
errors.push(err);
33+
}
34+
try {
35+
const candidate = processPath(require('../deps/csfle/lib/mongo_crypt_v1.so'));
36+
await fs.access(candidate);
37+
csfleLibraryPath = candidate;
38+
} catch (err: any) {
39+
errors.push(err);
40+
}
41+
try {
42+
const candidate = processPath(require('../deps/csfle/lib/mongo_crypt_v1.dylib'));
43+
await fs.access(candidate);
44+
csfleLibraryPath = candidate;
45+
} catch (err: any) {
46+
errors.push(err);
47+
}
48+
// Drop these as soon as the rename has been completed.
2749
try {
2850
const candidate = processPath(require('../deps/csfle/bin/mongo_csfle_v1.dll'));
2951
await fs.access(candidate);
@@ -53,8 +75,8 @@ export async function setupCSFLELibrary(): Promise<void> {
5375
} else {
5476
log.info(mongoLogId(1_001_000_125), 'CSFLE', 'Found CSFLE library', {
5577
csfleLibraryPath,
56-
externalOverride: process.env.COMPASS_CSFLE_LIBRARY_PATH
78+
externalOverride: process.env.COMPASS_CRYPT_LIBRARY_PATH
5779
});
58-
process.env.COMPASS_CSFLE_LIBRARY_PATH ??= csfleLibraryPath;
80+
process.env.COMPASS_CRYPT_LIBRARY_PATH ??= csfleLibraryPath;
5981
}
6082
}

packages/data-service/src/connect-mongo-client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ export default async function connectMongoClientCompass(
4040
autoEncryption: connectionOptions.fleOptions?.autoEncryption,
4141
};
4242

43-
if (options.autoEncryption && process.env.COMPASS_CSFLE_LIBRARY_PATH) {
43+
if (options.autoEncryption && process.env.COMPASS_CRYPT_LIBRARY_PATH) {
4444
options.autoEncryption = {
4545
...options.autoEncryption,
4646
extraOptions: {
4747
...options.autoEncryption?.extraOptions,
48-
csflePath: process.env.COMPASS_CSFLE_LIBRARY_PATH,
48+
csflePath: process.env.COMPASS_CRYPT_LIBRARY_PATH,
4949
},
5050
};
5151
}

packages/data-service/src/csfle-collection-tracker.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('CSFLECollectionTracker', function () {
2121
let dbName: string;
2222

2323
before(function () {
24-
if (!process.env.COMPASS_CSFLE_LIBRARY_PATH) {
24+
if (!process.env.COMPASS_CRYPT_LIBRARY_PATH) {
2525
return this.skip();
2626
}
2727
dbName = `test-${Date.now()}-${(Math.random() * 10000) | 0}`;
@@ -43,7 +43,7 @@ describe('CSFLECollectionTracker', function () {
4343
kmsProviders: { local: { key: 'A'.repeat(128) } },
4444
keyVaultNamespace: `${dbName}.kv`,
4545
extraOptions: {
46-
csflePath: process.env.COMPASS_CSFLE_LIBRARY_PATH,
46+
csflePath: process.env.COMPASS_CRYPT_LIBRARY_PATH,
4747
},
4848
...autoEncryption,
4949
},

0 commit comments

Comments
 (0)