Skip to content

Commit f765c07

Browse files
authored
chore: replace references to csfle shared library MONGOSH-1237 (#1297)
1 parent d38049e commit f765c07

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+293
-292
lines changed

config/build.conf.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ const EXECUTABLE_PATH = path.join(OUTPUT_DIR, process.platform === 'win32' ? 'mo
5050

5151
/**
5252
* The path to the downloaded csfe shared library.
53-
* We use the name mongosh_csfle_v1 to avoid conflicts with users
54-
* potentially installing the 'proper' csfle shared library.
53+
* We use the name mongosh_crypt_v1 to avoid conflicts with users
54+
* potentially installing the 'proper' crypt shared library.
5555
*/
56-
const CSFLE_LIBRARY_PATH = path.resolve(TMP_DIR, 'mongosh_csfle_v1.' + SHARED_LIBRARY_SUFFIX);
56+
const CRYPT_LIBRARY_PATH = path.resolve(TMP_DIR, 'mongosh_crypt_v1.' + SHARED_LIBRARY_SUFFIX);
5757

5858
/**
5959
* Build info JSON data file.
@@ -119,7 +119,7 @@ module.exports = {
119119
repo: 'mongosh'
120120
},
121121
artifactUrlFile: process.env.ARTIFACT_URL_FILE,
122-
csfleLibraryPath: CSFLE_LIBRARY_PATH,
122+
cryptSharedLibPath: CRYPT_LIBRARY_PATH,
123123
packageInformation: {
124124
binaries: [
125125
{
@@ -134,11 +134,11 @@ module.exports = {
134134
}
135135
},
136136
{
137-
sourceFilePath: CSFLE_LIBRARY_PATH,
137+
sourceFilePath: CRYPT_LIBRARY_PATH,
138138
category: 'lib',
139139
license: {
140-
sourceFilePath: path.resolve(__dirname, '..', 'packaging', 'LICENSE-csfle'),
141-
packagedFilePath: 'LICENSE-csfle',
140+
sourceFilePath: path.resolve(__dirname, '..', 'packaging', 'LICENSE-crypt-library'),
141+
packagedFilePath: 'LICENSE-crypt-library',
142142
debCopyright: COPYRIGHT,
143143
debIdentifier: 'Proprietary',
144144
rpmIdentifier: 'Proprietary'

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
"lerna": "^4.0.0",
125125
"mocha": "^7.1.2",
126126
"mongodb": "^4.6.0",
127-
"mongodb-download-url": "^1.2.1",
127+
"mongodb-download-url": "^1.2.2",
128128
"mongodb-js-precommit": "^2.0.0",
129129
"nock": "^13.0.11",
130130
"node-codesign": "^0.3.3",

packages/arg-parser/src/arg-mapper.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ const MAPPINGS: {
105105
awsSecretAccessKey: (i, v) => setAWSKMS(i, 'secretAccessKey', v),
106106
awsSessionToken: (i, v) => setAWSKMS(i, 'sessionToken', v),
107107
awsIamSessionToken: (i, v) => setAuthMechProp(i, 'AWS_SESSION_TOKEN', v),
108-
csfleLibraryPath: (i, v) => setAutoEncryptExtra(i, 'csflePath', v),
108+
// @ts-expect-error AutoEncryption options have been renamed, drop the (outer) csflePath call after the next release
109+
csfleLibraryPath: (i, v) => setAutoEncryptExtra(setAutoEncryptExtra(i, 'cryptSharedLibPath', v), 'csflePath', v),
110+
// @ts-expect-error AutoEncryption options have been renamed, drop the (outer) csflePath call after the next release
111+
cryptSharedLibPath: (i, v) => setAutoEncryptExtra(setAutoEncryptExtra(i, 'cryptSharedLibPath', v), 'csflePath', v),
109112
gssapiServiceName: (i, v) => setAuthMechProp(i, 'SERVICE_NAME', v),
110113
sspiRealmOverride: (i, v) => setAuthMechProp(i, 'SERVICE_REALM', v),
111114
sspiHostnameCanonicalization:

packages/arg-parser/src/cli-options.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export interface CliOptions {
1717
awsSecretAccessKey?: string;
1818
awsSessionToken?: string;
1919
csfleLibraryPath?: string;
20+
cryptSharedLibPath?: string;
2021
db?: string;
2122
eval?: string;
2223
gssapiServiceName?: string;

packages/build/src/compile/signable-compiler.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ export class SignableCompiler {
9393
path: await findModulePath('service-provider-server', 'os-dns-native'),
9494
requireRegexp: /\bos_dns_native\.node$/
9595
};
96-
const csfleLibraryVersionAddon = {
97-
path: await findModulePath('cli-repl', 'mongodb-csfle-library-version'),
98-
requireRegexp: /\bmongodb_csfle_library_version\.node$/
96+
const cryptLibraryVersionAddon = {
97+
path: await findModulePath('cli-repl', 'mongodb-crypt-library-version'),
98+
requireRegexp: /\bmongodb_crypt_library_version\.node$/
9999
};
100100
// Warning! Until https://jira.mongodb.org/browse/MONGOSH-990,
101101
// packages/service-provider-server *also* has a copy of these.
@@ -137,7 +137,7 @@ export class SignableCompiler {
137137
fleAddon,
138138
osDnsAddon,
139139
kerberosAddon,
140-
csfleLibraryVersionAddon
140+
cryptLibraryVersionAddon
141141
].concat(winCAAddon ? [
142142
winCAAddon
143143
] : []).concat(winConsoleProcessListAddon ? [

packages/build/src/config/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export interface Config {
4040
};
4141
isPatch?: boolean;
4242
triggeringGitTag?: string;
43-
csfleLibraryPath: string;
43+
cryptSharedLibPath: string;
4444
packageInformation?: PackageInformation;
4545
artifactUrlFile?: string;
4646
manpage?: ManPageConfig;

packages/build/src/config/redact-config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function redactConfig(config: Config): Partial<Config> {
1717
repo: config.repo,
1818
isPatch: config.isPatch,
1919
packageInformation: config.packageInformation,
20-
csfleLibraryPath: config.csfleLibraryPath,
20+
cryptSharedLibPath: config.cryptSharedLibPath,
2121
artifactUrlFile: config.artifactUrlFile,
2222
isDryRun: config.isDryRun
2323
};

packages/build/src/download-mongodb.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export async function downloadMongoDb(tmpdir: string, targetVersionSemverSpecifi
2525

2626
await fs.mkdir(tmpdir, { recursive: true });
2727
if (targetVersionSemverSpecifier === 'latest-alpha') {
28-
return await doDownload(tmpdir, !!options.csfle, 'latest-alpha', lookupDownloadUrl);
28+
return await doDownload(tmpdir, !!options.crypt_shared, 'latest-alpha', lookupDownloadUrl);
2929
}
3030

3131
if (/-community$/.test(targetVersionSemverSpecifier)) {
@@ -35,15 +35,15 @@ export async function downloadMongoDb(tmpdir: string, targetVersionSemverSpecifi
3535

3636
return await doDownload(
3737
tmpdir,
38-
!!options.csfle,
38+
!!options.crypt_shared,
3939
targetVersionSemverSpecifier + (wantsEnterprise ? '-enterprise' : '-community'),
4040
() => lookupDownloadUrl());
4141
}
4242

4343
const downloadPromises: Record<string, Promise<string>> = {};
4444
async function doDownload(
4545
tmpdir: string,
46-
isCsfle: boolean,
46+
isCryptLibrary: boolean,
4747
version: string,
4848
lookupDownloadUrl: () => Promise<string>) {
4949
const downloadTarget = path.resolve(
@@ -53,7 +53,7 @@ async function doDownload(
5353
return downloadPromises[downloadTarget] ??= (async() => {
5454
const bindir = path.resolve(
5555
downloadTarget,
56-
isCsfle && process.platform !== 'win32' ? 'lib' : 'bin');
56+
isCryptLibrary && process.platform !== 'win32' ? 'lib' : 'bin');
5757
try {
5858
await fs.stat(bindir);
5959
console.info(`Skipping download because ${downloadTarget} exists`);
@@ -71,10 +71,10 @@ async function doDownload(
7171
const response = await fetch(url);
7272
await promisify(pipeline)(
7373
response.body,
74-
tar.x({ cwd: downloadTarget, strip: isCsfle ? 0 : 1 })
74+
tar.x({ cwd: downloadTarget, strip: isCryptLibrary ? 0 : 1 })
7575
);
7676
} else {
77-
await download(url, downloadTarget, { extract: true, strip: isCsfle ? 0 : 1 });
77+
await download(url, downloadTarget, { extract: true, strip: isCryptLibrary ? 0 : 1 });
7878
}
7979

8080
try {

packages/build/src/packaging/download-csfle-library.ts renamed to packages/build/src/packaging/download-crypt-library.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,36 @@ import { promises as fs, constants as fsConstants } from 'fs';
44
import { downloadMongoDb, DownloadOptions } from '../download-mongodb';
55
import { BuildVariant, getDistro, getArch } from '../config';
66

7-
export async function downloadCsfleLibrary(variant: BuildVariant | 'host'): Promise<string> {
7+
export async function downloadCryptLibrary(variant: BuildVariant | 'host'): Promise<string> {
88
const opts: DownloadOptions = {};
99
opts.arch = variant === 'host' ? undefined : getArch(variant);
1010
opts.distro = variant === 'host' ? undefined : lookupReleaseDistro(variant);
1111
opts.enterprise = true;
12-
opts.csfle = true;
13-
console.info('mongosh: downloading latest csfle shared library for inclusion in package:', JSON.stringify(opts));
12+
opts.crypt_shared = true;
13+
console.info('mongosh: downloading latest crypt shared library for inclusion in package:', JSON.stringify(opts));
1414

1515
let libdir = '';
16-
const csfleTmpTargetDir = path.resolve(__dirname, '..', '..', '..', '..', 'tmp', 'csfle-store', variant);
16+
const cryptTmpTargetDir = path.resolve(__dirname, '..', '..', '..', '..', 'tmp', 'crypt-store', variant);
1717
// Download mongodb for latest server version. Fall back to the 6.0.0-rcX
1818
// version if no stable version is available.
1919
let error: Error | undefined;
2020
for (const version of [ 'stable', '>= 6.0.0-rc5' ]) {
2121
try {
22-
libdir = await downloadMongoDb(csfleTmpTargetDir, version, opts);
22+
libdir = await downloadMongoDb(cryptTmpTargetDir, version, opts);
2323
break;
2424
} catch (e: any) {
2525
error = e;
2626
}
2727
}
2828
if (!libdir) throw error;
29-
const csfleLibrary = path.join(
29+
const cryptLibrary = path.join(
3030
libdir,
31-
(await fs.readdir(libdir)).find(filename => filename.match(/^mongo_csfle_v1\.(so|dylib|dll)$/)) as string
31+
(await fs.readdir(libdir)).find(filename => filename.match(/^mongo_crypt_v1\.(so|dylib|dll)$/)) as string
3232
);
3333
// Make sure that the binary exists and is readable.
34-
await fs.access(csfleLibrary, fsConstants.R_OK);
35-
console.info('mongosh: downloaded', csfleLibrary);
36-
return csfleLibrary;
34+
await fs.access(cryptLibrary, fsConstants.R_OK);
35+
console.info('mongosh: downloaded', cryptLibrary);
36+
return cryptLibrary;
3737
}
3838

3939
function lookupReleaseDistro(variant: BuildVariant): string {

0 commit comments

Comments
 (0)