diff --git a/config/build.conf.js b/config/build.conf.js index 86433b64ac..69c3194123 100644 --- a/config/build.conf.js +++ b/config/build.conf.js @@ -50,10 +50,10 @@ const EXECUTABLE_PATH = path.join(OUTPUT_DIR, process.platform === 'win32' ? 'mo /** * The path to the downloaded csfe shared library. - * We use the name mongosh_csfle_v1 to avoid conflicts with users - * potentially installing the 'proper' csfle shared library. + * We use the name mongosh_crypt_v1 to avoid conflicts with users + * potentially installing the 'proper' crypt shared library. */ -const CSFLE_LIBRARY_PATH = path.resolve(TMP_DIR, 'mongosh_csfle_v1.' + SHARED_LIBRARY_SUFFIX); +const CRYPT_LIBRARY_PATH = path.resolve(TMP_DIR, 'mongosh_crypt_v1.' + SHARED_LIBRARY_SUFFIX); /** * Build info JSON data file. @@ -119,7 +119,7 @@ module.exports = { repo: 'mongosh' }, artifactUrlFile: process.env.ARTIFACT_URL_FILE, - csfleLibraryPath: CSFLE_LIBRARY_PATH, + cryptSharedLibPath: CRYPT_LIBRARY_PATH, packageInformation: { binaries: [ { @@ -134,11 +134,11 @@ module.exports = { } }, { - sourceFilePath: CSFLE_LIBRARY_PATH, + sourceFilePath: CRYPT_LIBRARY_PATH, category: 'lib', license: { - sourceFilePath: path.resolve(__dirname, '..', 'packaging', 'LICENSE-csfle'), - packagedFilePath: 'LICENSE-csfle', + sourceFilePath: path.resolve(__dirname, '..', 'packaging', 'LICENSE-crypt-library'), + packagedFilePath: 'LICENSE-crypt-library', debCopyright: COPYRIGHT, debIdentifier: 'Proprietary', rpmIdentifier: 'Proprietary' diff --git a/package-lock.json b/package-lock.json index 6e99b0520b..14e63a2a68 100644 --- a/package-lock.json +++ b/package-lock.json @@ -54,7 +54,7 @@ "lerna": "^4.0.0", "mocha": "^7.1.2", "mongodb": "^4.6.0", - "mongodb-download-url": "^1.2.1", + "mongodb-download-url": "^1.2.2", "mongodb-js-precommit": "^2.0.0", "nock": "^13.0.11", "node-codesign": "^0.3.3", @@ -16878,9 +16878,9 @@ } }, "node_modules/mongodb-download-url": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/mongodb-download-url/-/mongodb-download-url-1.2.1.tgz", - "integrity": "sha512-mbng29zM8kQKDHo7ZVnr2QTrAbUSx8dIP4GuaoH4tLNNdkYu7ilo6ihfOK1ZOMYWMkE0N6Snq5Z1OynQ+QvHog==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/mongodb-download-url/-/mongodb-download-url-1.2.2.tgz", + "integrity": "sha512-RD3jsswLVMkVp6QVudrKPLNMmiC1FHElTkTzU845K1Pr8ZL7M9HSBvVThXKrLT/WgChUHohEeCsmCmgeHW3ajQ==", "dev": true, "dependencies": { "debug": "^4.1.1", @@ -41403,9 +41403,9 @@ } }, "mongodb-download-url": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/mongodb-download-url/-/mongodb-download-url-1.2.1.tgz", - "integrity": "sha512-mbng29zM8kQKDHo7ZVnr2QTrAbUSx8dIP4GuaoH4tLNNdkYu7ilo6ihfOK1ZOMYWMkE0N6Snq5Z1OynQ+QvHog==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/mongodb-download-url/-/mongodb-download-url-1.2.2.tgz", + "integrity": "sha512-RD3jsswLVMkVp6QVudrKPLNMmiC1FHElTkTzU845K1Pr8ZL7M9HSBvVThXKrLT/WgChUHohEeCsmCmgeHW3ajQ==", "dev": true, "requires": { "debug": "^4.1.1", diff --git a/package.json b/package.json index 41a6516026..15032edbca 100644 --- a/package.json +++ b/package.json @@ -124,7 +124,7 @@ "lerna": "^4.0.0", "mocha": "^7.1.2", "mongodb": "^4.6.0", - "mongodb-download-url": "^1.2.1", + "mongodb-download-url": "^1.2.2", "mongodb-js-precommit": "^2.0.0", "nock": "^13.0.11", "node-codesign": "^0.3.3", diff --git a/packages/arg-parser/src/arg-mapper.ts b/packages/arg-parser/src/arg-mapper.ts index c96707b6b2..4bde06eabe 100644 --- a/packages/arg-parser/src/arg-mapper.ts +++ b/packages/arg-parser/src/arg-mapper.ts @@ -105,7 +105,10 @@ const MAPPINGS: { awsSecretAccessKey: (i, v) => setAWSKMS(i, 'secretAccessKey', v), awsSessionToken: (i, v) => setAWSKMS(i, 'sessionToken', v), awsIamSessionToken: (i, v) => setAuthMechProp(i, 'AWS_SESSION_TOKEN', v), - csfleLibraryPath: (i, v) => setAutoEncryptExtra(i, 'csflePath', v), + // @ts-expect-error AutoEncryption options have been renamed, drop the (outer) csflePath call after the next release + csfleLibraryPath: (i, v) => setAutoEncryptExtra(setAutoEncryptExtra(i, 'cryptSharedLibPath', v), 'csflePath', v), + // @ts-expect-error AutoEncryption options have been renamed, drop the (outer) csflePath call after the next release + cryptSharedLibPath: (i, v) => setAutoEncryptExtra(setAutoEncryptExtra(i, 'cryptSharedLibPath', v), 'csflePath', v), gssapiServiceName: (i, v) => setAuthMechProp(i, 'SERVICE_NAME', v), sspiRealmOverride: (i, v) => setAuthMechProp(i, 'SERVICE_REALM', v), sspiHostnameCanonicalization: diff --git a/packages/arg-parser/src/cli-options.ts b/packages/arg-parser/src/cli-options.ts index 3976487feb..14ef7212c3 100644 --- a/packages/arg-parser/src/cli-options.ts +++ b/packages/arg-parser/src/cli-options.ts @@ -17,6 +17,7 @@ export interface CliOptions { awsSecretAccessKey?: string; awsSessionToken?: string; csfleLibraryPath?: string; + cryptSharedLibPath?: string; db?: string; eval?: string; gssapiServiceName?: string; diff --git a/packages/build/src/compile/signable-compiler.ts b/packages/build/src/compile/signable-compiler.ts index 6d0abba129..bf2b3bce1f 100644 --- a/packages/build/src/compile/signable-compiler.ts +++ b/packages/build/src/compile/signable-compiler.ts @@ -93,9 +93,9 @@ export class SignableCompiler { path: await findModulePath('service-provider-server', 'os-dns-native'), requireRegexp: /\bos_dns_native\.node$/ }; - const csfleLibraryVersionAddon = { - path: await findModulePath('cli-repl', 'mongodb-csfle-library-version'), - requireRegexp: /\bmongodb_csfle_library_version\.node$/ + const cryptLibraryVersionAddon = { + path: await findModulePath('cli-repl', 'mongodb-crypt-library-version'), + requireRegexp: /\bmongodb_crypt_library_version\.node$/ }; // Warning! Until https://jira.mongodb.org/browse/MONGOSH-990, // packages/service-provider-server *also* has a copy of these. @@ -137,7 +137,7 @@ export class SignableCompiler { fleAddon, osDnsAddon, kerberosAddon, - csfleLibraryVersionAddon + cryptLibraryVersionAddon ].concat(winCAAddon ? [ winCAAddon ] : []).concat(winConsoleProcessListAddon ? [ diff --git a/packages/build/src/config/config.ts b/packages/build/src/config/config.ts index 5e04bed903..e30696fd75 100644 --- a/packages/build/src/config/config.ts +++ b/packages/build/src/config/config.ts @@ -40,7 +40,7 @@ export interface Config { }; isPatch?: boolean; triggeringGitTag?: string; - csfleLibraryPath: string; + cryptSharedLibPath: string; packageInformation?: PackageInformation; artifactUrlFile?: string; manpage?: ManPageConfig; diff --git a/packages/build/src/config/redact-config.ts b/packages/build/src/config/redact-config.ts index 78679193fd..72c626cb55 100644 --- a/packages/build/src/config/redact-config.ts +++ b/packages/build/src/config/redact-config.ts @@ -17,7 +17,7 @@ export function redactConfig(config: Config): Partial { repo: config.repo, isPatch: config.isPatch, packageInformation: config.packageInformation, - csfleLibraryPath: config.csfleLibraryPath, + cryptSharedLibPath: config.cryptSharedLibPath, artifactUrlFile: config.artifactUrlFile, isDryRun: config.isDryRun }; diff --git a/packages/build/src/download-mongodb.ts b/packages/build/src/download-mongodb.ts index 2197755e20..ff02796611 100644 --- a/packages/build/src/download-mongodb.ts +++ b/packages/build/src/download-mongodb.ts @@ -25,7 +25,7 @@ export async function downloadMongoDb(tmpdir: string, targetVersionSemverSpecifi await fs.mkdir(tmpdir, { recursive: true }); if (targetVersionSemverSpecifier === 'latest-alpha') { - return await doDownload(tmpdir, !!options.csfle, 'latest-alpha', lookupDownloadUrl); + return await doDownload(tmpdir, !!options.crypt_shared, 'latest-alpha', lookupDownloadUrl); } if (/-community$/.test(targetVersionSemverSpecifier)) { @@ -35,7 +35,7 @@ export async function downloadMongoDb(tmpdir: string, targetVersionSemverSpecifi return await doDownload( tmpdir, - !!options.csfle, + !!options.crypt_shared, targetVersionSemverSpecifier + (wantsEnterprise ? '-enterprise' : '-community'), () => lookupDownloadUrl()); } @@ -43,7 +43,7 @@ export async function downloadMongoDb(tmpdir: string, targetVersionSemverSpecifi const downloadPromises: Record> = {}; async function doDownload( tmpdir: string, - isCsfle: boolean, + isCryptLibrary: boolean, version: string, lookupDownloadUrl: () => Promise) { const downloadTarget = path.resolve( @@ -53,7 +53,7 @@ async function doDownload( return downloadPromises[downloadTarget] ??= (async() => { const bindir = path.resolve( downloadTarget, - isCsfle && process.platform !== 'win32' ? 'lib' : 'bin'); + isCryptLibrary && process.platform !== 'win32' ? 'lib' : 'bin'); try { await fs.stat(bindir); console.info(`Skipping download because ${downloadTarget} exists`); @@ -71,10 +71,10 @@ async function doDownload( const response = await fetch(url); await promisify(pipeline)( response.body, - tar.x({ cwd: downloadTarget, strip: isCsfle ? 0 : 1 }) + tar.x({ cwd: downloadTarget, strip: isCryptLibrary ? 0 : 1 }) ); } else { - await download(url, downloadTarget, { extract: true, strip: isCsfle ? 0 : 1 }); + await download(url, downloadTarget, { extract: true, strip: isCryptLibrary ? 0 : 1 }); } try { diff --git a/packages/build/src/packaging/download-csfle-library.ts b/packages/build/src/packaging/download-crypt-library.ts similarity index 73% rename from packages/build/src/packaging/download-csfle-library.ts rename to packages/build/src/packaging/download-crypt-library.ts index f7eaac7037..c67eaa1666 100644 --- a/packages/build/src/packaging/download-csfle-library.ts +++ b/packages/build/src/packaging/download-crypt-library.ts @@ -4,36 +4,36 @@ import { promises as fs, constants as fsConstants } from 'fs'; import { downloadMongoDb, DownloadOptions } from '../download-mongodb'; import { BuildVariant, getDistro, getArch } from '../config'; -export async function downloadCsfleLibrary(variant: BuildVariant | 'host'): Promise { +export async function downloadCryptLibrary(variant: BuildVariant | 'host'): Promise { const opts: DownloadOptions = {}; opts.arch = variant === 'host' ? undefined : getArch(variant); opts.distro = variant === 'host' ? undefined : lookupReleaseDistro(variant); opts.enterprise = true; - opts.csfle = true; - console.info('mongosh: downloading latest csfle shared library for inclusion in package:', JSON.stringify(opts)); + opts.crypt_shared = true; + console.info('mongosh: downloading latest crypt shared library for inclusion in package:', JSON.stringify(opts)); let libdir = ''; - const csfleTmpTargetDir = path.resolve(__dirname, '..', '..', '..', '..', 'tmp', 'csfle-store', variant); + const cryptTmpTargetDir = path.resolve(__dirname, '..', '..', '..', '..', 'tmp', 'crypt-store', variant); // Download mongodb for latest server version. Fall back to the 6.0.0-rcX // version if no stable version is available. let error: Error | undefined; for (const version of [ 'stable', '>= 6.0.0-rc5' ]) { try { - libdir = await downloadMongoDb(csfleTmpTargetDir, version, opts); + libdir = await downloadMongoDb(cryptTmpTargetDir, version, opts); break; } catch (e: any) { error = e; } } if (!libdir) throw error; - const csfleLibrary = path.join( + const cryptLibrary = path.join( libdir, - (await fs.readdir(libdir)).find(filename => filename.match(/^mongo_csfle_v1\.(so|dylib|dll)$/)) as string + (await fs.readdir(libdir)).find(filename => filename.match(/^mongo_crypt_v1\.(so|dylib|dll)$/)) as string ); // Make sure that the binary exists and is readable. - await fs.access(csfleLibrary, fsConstants.R_OK); - console.info('mongosh: downloaded', csfleLibrary); - return csfleLibrary; + await fs.access(cryptLibrary, fsConstants.R_OK); + console.info('mongosh: downloaded', cryptLibrary); + return cryptLibrary; } function lookupReleaseDistro(variant: BuildVariant): string { diff --git a/packages/build/src/packaging/run-package.ts b/packages/build/src/packaging/run-package.ts index b4b9d6043c..98ab678361 100644 --- a/packages/build/src/packaging/run-package.ts +++ b/packages/build/src/packaging/run-package.ts @@ -1,7 +1,7 @@ import { constants as fsConstants, promises as fs } from 'fs'; import path from 'path'; import { Config, validateBuildVariant } from '../config'; -import { downloadCsfleLibrary } from './download-csfle-library'; +import { downloadCryptLibrary } from './download-crypt-library'; import { downloadManpage } from './download-manpage'; import { notarizeArtifact } from './notary-service'; import { createPackage, PackageFile } from './package'; @@ -12,10 +12,10 @@ export async function runPackage( const distributionBuildVariant = config.distributionBuildVariant; validateBuildVariant(distributionBuildVariant); - await fs.mkdir(path.dirname(config.csfleLibraryPath), { recursive: true }); + await fs.mkdir(path.dirname(config.cryptSharedLibPath), { recursive: true }); await fs.copyFile( - await downloadCsfleLibrary(distributionBuildVariant), - config.csfleLibraryPath, + await downloadCryptLibrary(distributionBuildVariant), + config.cryptSharedLibPath, fsConstants.COPYFILE_FICLONE); const { manpage } = config; diff --git a/packages/build/test/helpers.ts b/packages/build/test/helpers.ts index a6e2f4d4f7..b940f92897 100644 --- a/packages/build/test/helpers.ts +++ b/packages/build/test/helpers.ts @@ -29,7 +29,7 @@ export const dummyConfig: Config = Object.freeze({ bundleEntrypointInput: 'bundleEntrypointInput', bundleSinglefileOutput: 'bundleSinglefileOutput', executablePath: 'executablePath', - csfleLibraryPath: 'csfleLibraryPath', + cryptSharedLibPath: 'cryptSharedLibPath', outputDir: 'outputDir', buildInfoFilePath: 'buildInfoFilePath', project: 'project', diff --git a/packages/cli-repl/package-lock.json b/packages/cli-repl/package-lock.json index 37222beec2..543a164918 100644 --- a/packages/cli-repl/package-lock.json +++ b/packages/cli-repl/package-lock.json @@ -40,7 +40,7 @@ "chai-as-promised": "^7.1.1", "lodash": "^4.17.21", "moment": "^2.29.1", - "mongodb-csfle-library-dummy": "^1.0.1" + "mongodb-crypt-library-dummy": "^1.0.2" }, "engines": { "node": ">=16.15.0" @@ -48,7 +48,7 @@ "optionalDependencies": { "get-console-process-list": "^1.0.4", "macos-export-certificate-and-key": "^1.1.1", - "mongodb-csfle-library-version": "^1.0.2", + "mongodb-crypt-library-version": "^1.0.3", "win-export-certificate-and-key": "^1.1.1" } }, @@ -761,17 +761,17 @@ "whatwg-url": "^11.0.0" } }, - "node_modules/mongodb-csfle-library-dummy": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mongodb-csfle-library-dummy/-/mongodb-csfle-library-dummy-1.0.1.tgz", - "integrity": "sha512-HrNXwbXcgyO93EqCuNpeUborAmO5Vmr8ZCswxk7MdAke1dO8gmNo02NlabE47PwiCGzf3TPzmX5cf4K7TXIt3Q==", + "node_modules/mongodb-crypt-library-dummy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/mongodb-crypt-library-dummy/-/mongodb-crypt-library-dummy-1.0.2.tgz", + "integrity": "sha512-k7kF3Vt+N+Q8JlCUBZQEhd1aL0Ndqv7XZwLDSTJFTwbbrlrATygPVNEoJaC1sTww5ZH36aT7MZSp70kf29Lr6A==", "dev": true, "hasInstallScript": true }, - "node_modules/mongodb-csfle-library-version": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/mongodb-csfle-library-version/-/mongodb-csfle-library-version-1.0.2.tgz", - "integrity": "sha512-DzO4BDGh8nQUEjr7HcB9w1K1CZlfWQRA1Rkq1ROk8aJoaaEK2m++cyVHVUNzHGrYu7X1r5yqHlGxfPw5bSEU0w==", + "node_modules/mongodb-crypt-library-version": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/mongodb-crypt-library-version/-/mongodb-crypt-library-version-1.0.3.tgz", + "integrity": "sha512-w+T89kF9fC7npcf7m/+OUeXasf5TSL0GlugOCxzdXQFykV5MdU2yvcuuDZz4MD1pJickvGxBcw41jGg2s4lJ0g==", "hasInstallScript": true, "optional": true, "dependencies": { @@ -779,7 +779,7 @@ "node-addon-api": "^4.3.0" }, "bin": { - "mongodb-csfle-library-version": "bin/mongodb-csfle-library-version.js" + "mongodb-crypt-library-version": "bin/mongodb-crypt-library-version.js" } }, "node_modules/mongodb-log-writer": { @@ -1537,16 +1537,16 @@ "whatwg-url": "^11.0.0" } }, - "mongodb-csfle-library-dummy": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mongodb-csfle-library-dummy/-/mongodb-csfle-library-dummy-1.0.1.tgz", - "integrity": "sha512-HrNXwbXcgyO93EqCuNpeUborAmO5Vmr8ZCswxk7MdAke1dO8gmNo02NlabE47PwiCGzf3TPzmX5cf4K7TXIt3Q==", + "mongodb-crypt-library-dummy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/mongodb-crypt-library-dummy/-/mongodb-crypt-library-dummy-1.0.2.tgz", + "integrity": "sha512-k7kF3Vt+N+Q8JlCUBZQEhd1aL0Ndqv7XZwLDSTJFTwbbrlrATygPVNEoJaC1sTww5ZH36aT7MZSp70kf29Lr6A==", "dev": true }, - "mongodb-csfle-library-version": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/mongodb-csfle-library-version/-/mongodb-csfle-library-version-1.0.2.tgz", - "integrity": "sha512-DzO4BDGh8nQUEjr7HcB9w1K1CZlfWQRA1Rkq1ROk8aJoaaEK2m++cyVHVUNzHGrYu7X1r5yqHlGxfPw5bSEU0w==", + "mongodb-crypt-library-version": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/mongodb-crypt-library-version/-/mongodb-crypt-library-version-1.0.3.tgz", + "integrity": "sha512-w+T89kF9fC7npcf7m/+OUeXasf5TSL0GlugOCxzdXQFykV5MdU2yvcuuDZz4MD1pJickvGxBcw41jGg2s4lJ0g==", "optional": true, "requires": { "bindings": "^1.5.0", diff --git a/packages/cli-repl/package.json b/packages/cli-repl/package.json index b850113500..f580224b35 100644 --- a/packages/cli-repl/package.json +++ b/packages/cli-repl/package.json @@ -94,12 +94,12 @@ "chai-as-promised": "^7.1.1", "lodash": "^4.17.21", "moment": "^2.29.1", - "mongodb-csfle-library-dummy": "^1.0.1" + "mongodb-crypt-library-dummy": "^1.0.2" }, "optionalDependencies": { "get-console-process-list": "^1.0.4", "macos-export-certificate-and-key": "^1.1.1", "win-export-certificate-and-key": "^1.1.1", - "mongodb-csfle-library-version": "^1.0.2" + "mongodb-crypt-library-version": "^1.0.3" } } diff --git a/packages/cli-repl/src/arg-parser.ts b/packages/cli-repl/src/arg-parser.ts index 7c2d81c6ae..e647befa08 100644 --- a/packages/cli-repl/src/arg-parser.ts +++ b/packages/cli-repl/src/arg-parser.ts @@ -24,6 +24,7 @@ const OPTIONS = { 'awsSessionToken', 'awsIamSessionToken', 'csfleLibraryPath', + 'cryptSharedLibPath', 'db', 'eval', 'gssapiHostName', diff --git a/packages/cli-repl/src/cli-repl.ts b/packages/cli-repl/src/cli-repl.ts index 5581e16437..9702f210d0 100644 --- a/packages/cli-repl/src/cli-repl.ts +++ b/packages/cli-repl/src/cli-repl.ts @@ -18,7 +18,7 @@ import { buildInfo } from './build-info'; import type { StyleDefinition } from './clr'; import { ConfigManager, ShellHomeDirectory, ShellHomePaths } from './config-directory'; import { CliReplErrors } from './error-codes'; -import type { CSFLELibraryPathResult } from './csfle-library-paths'; +import type { CryptLibraryPathResult } from './crypt-library-paths'; import { MongoLogManager, MongoLogWriter, mongoLogId } from 'mongodb-log-writer'; import MongoshNodeRepl, { MongoshNodeReplOptions, MongoshIOProvider } from './mongosh-repl'; import { setupLoggerAndTelemetry, ToggleableAnalytics } from '@mongosh/logging'; @@ -50,8 +50,8 @@ type AnalyticsOptions = { export type CliReplOptions = { /** The set of parsed command line flags. */ shellCliOptions: CliOptions; - /** A function for getting the shared library path for CSFLE. */ - getCSFLELibraryPaths?: (bus: MongoshBus) => Promise; + /** A function for getting the shared library path for in-use encryption. */ + getCryptLibraryPaths?: (bus: MongoshBus) => Promise; /** The stream to read user input from. */ input: Readable; /** The stream to write shell output to. */ @@ -78,8 +78,8 @@ class CliRepl implements MongoshIOProvider { mongoshRepl: MongoshNodeRepl; bus: MongoshBus; cliOptions: CliOptions; - getCSFLELibraryPaths?: (bus: MongoshBus) => Promise; - cachedCSFLELibraryPath?: Promise; + getCryptLibraryPaths?: (bus: MongoshBus) => Promise; + cachedCryptLibraryPath?: Promise; shellHomeDirectory: ShellHomeDirectory; configDirectory: ConfigManager; config: CliUserConfigOnDisk; @@ -114,7 +114,7 @@ class CliRepl implements MongoshIOProvider { enableTelemetry: true }; - this.getCSFLELibraryPaths = options.getCSFLELibraryPaths; + this.getCryptLibraryPaths = options.getCryptLibraryPaths; this.globalConfigPaths = options.globalConfigPaths ?? []; this.shellHomeDirectory = new ShellHomeDirectory(options.shellHomePaths); this.configDirectory = new ConfigManager( @@ -236,20 +236,20 @@ class CliRepl implements MongoshIOProvider { if (origExtraOptions.csflePath) { // If a CSFLE path has been specified through 'driverOptions', save it // for later use. - this.cachedCSFLELibraryPath = Promise.resolve({ + this.cachedCryptLibraryPath = Promise.resolve({ csflePath: origExtraOptions.csflePath }); } const extraOptions = { ...origExtraOptions, - ...await this.getCSFLELibraryOptions() + ...await this.getCryptLibraryOptions() }; driverOptions.autoEncryption = { ...driverOptions.autoEncryption, extraOptions }; } if (Object.keys(driverOptions.autoEncryption ?? {}).join(',') === 'extraOptions') { - // In this case, autoEncryption opts were only specified for CSFLE library specs + // In this case, autoEncryption opts were only specified for crypt library specs delete driverOptions.autoEncryption; } @@ -649,12 +649,12 @@ class CliRepl implements MongoshIOProvider { return this.mongoshRepl.clr(text, style); } - /** Get the right CSFLE shared library loading options. */ - async getCSFLELibraryOptions(): Promise { - if (!this.getCSFLELibraryPaths) { - throw new MongoshInternalError('This instance of mongosh is not configured for CSFLE'); + /** Get the right crypt shared library loading options. */ + async getCryptLibraryOptions(): Promise { + if (!this.getCryptLibraryPaths) { + throw new MongoshInternalError('This instance of mongosh is not configured for in-use encryption'); } - return (this.cachedCSFLELibraryPath ??= this.getCSFLELibraryPaths(this.bus)); + return (this.cachedCryptLibraryPath ??= this.getCryptLibraryPaths(this.bus)); } /** Provide extra information for reporting internal errors */ diff --git a/packages/cli-repl/src/crypt-library-paths.spec.ts b/packages/cli-repl/src/crypt-library-paths.spec.ts new file mode 100644 index 0000000000..46f1bdbf65 --- /dev/null +++ b/packages/cli-repl/src/crypt-library-paths.spec.ts @@ -0,0 +1,91 @@ +import { expect } from 'chai'; +import { SHARED_LIBRARY_SUFFIX, getCryptLibraryPaths } from './csfle-library-paths'; +import cryptLibraryDummy from 'mongodb-crypt-library-dummy'; +import type { MongoshBus } from '@mongosh/types'; +import { useTmpdir } from '../test/repl-helpers'; +import { EventEmitter } from 'events'; +import { promises as fs } from 'fs'; +import path from 'path'; + +describe('getCryptLibraryPaths', () => { + let bus: MongoshBus; + let events: any[]; + let fakeMongoshExecPath: string; + const tmpdir = useTmpdir(); + const csfleFilename = `mongosh_crypt_v1.${SHARED_LIBRARY_SUFFIX}`; + const expectedVersion = { version: BigInt('0x0001000000000000'), versionStr: 'mongo_crypt_v1-dummy' }; + + beforeEach(async function() { + events = []; + bus = new EventEmitter(); + bus.on('mongosh:crypt-library-load-found', (ev) => events.push(['mongosh:crypt-library-load-found', ev])); + bus.on('mongosh:crypt-library-load-skip', (ev) => events.push(['mongosh:crypt-library-load-skip', ev])); + fakeMongoshExecPath = path.join(tmpdir.path, 'bin', 'mongosh'); + await fs.mkdir(path.join(tmpdir.path, 'bin'), { recursive: true }); + await fs.mkdir(path.join(tmpdir.path, 'lib'), { recursive: true }); + await fs.mkdir(path.join(tmpdir.path, 'lib64'), { recursive: true }); + await fs.writeFile(fakeMongoshExecPath, '# dummy', { mode: 0o755 }); + }); + + it('will look up a shared library located in /../lib/', async function() { + const cryptSharedLibPath = path.join(tmpdir.path, 'lib', csfleFilename); + await fs.copyFile(cryptLibraryDummy, cryptSharedLibPath); + expect(await getCryptLibraryPaths(bus, fakeMongoshExecPath)).to.deep.equal({ + cryptSharedLibPath, + expectedVersion + }); + expect(events.slice(1)).to.deep.equal([ + [ 'mongosh:crypt-library-load-found', { cryptSharedLibPath, expectedVersion } ] + ]); + }); + + it('will look up a shared library located in /../lib64/', async function() { + const cryptSharedLibPath = path.join(tmpdir.path, 'lib64', csfleFilename); + await fs.copyFile(cryptLibraryDummy, cryptSharedLibPath); + expect(await getCryptLibraryPaths(bus, fakeMongoshExecPath)).to.deep.equal({ + cryptSharedLibPath, + expectedVersion + }); + expect(events).to.deep.equal([ + [ 'mongosh:crypt-library-load-found', { cryptSharedLibPath, expectedVersion } ] + ]); + }); + + it('will look up a shared library located in /', async function() { + const cryptSharedLibPath = path.join(tmpdir.path, 'bin', csfleFilename); + await fs.copyFile(cryptLibraryDummy, cryptSharedLibPath); + expect(await getCryptLibraryPaths(bus, fakeMongoshExecPath)).to.deep.equal({ + cryptSharedLibPath, + expectedVersion + }); + expect(events[0][0]).to.equal('mongosh:crypt-library-load-skip'); + expect(events[0][1].reason).to.match(/ENOENT|LoadLibraryW failed/); + expect(events.slice(2)).to.deep.equal([ + [ 'mongosh:crypt-library-load-found', { cryptSharedLibPath, expectedVersion } ] + ]); + }); + + it('will reject a shared library if it is not readable', async function() { + if (process.platform === 'win32') { + return this.skip(); + } + const cryptSharedLibPath = path.join(tmpdir.path, 'lib', csfleFilename); + await fs.copyFile(cryptLibraryDummy, cryptSharedLibPath); + await fs.chmod(cryptSharedLibPath, 0o000); + expect(await getCryptLibraryPaths(bus, fakeMongoshExecPath)).to.deep.equal({}); + expect(events[1][0]).to.equal('mongosh:crypt-library-load-skip'); + expect(events[1][1].reason).to.include('EACCES'); + }); + + it('will reject a shared library if its permissions are world-writable', async function() { + if (process.platform === 'win32') { + return this.skip(); + } + const cryptSharedLibPath = path.join(tmpdir.path, 'lib', csfleFilename); + await fs.copyFile(cryptLibraryDummy, cryptSharedLibPath); + await fs.chmod(cryptSharedLibPath, 0o777); + expect(await getCryptLibraryPaths(bus, fakeMongoshExecPath)).to.deep.equal({}); + expect(events[1][0]).to.equal('mongosh:crypt-library-load-skip'); + expect(events[1][1].reason).to.include('permissions mismatch'); + }); +}); diff --git a/packages/cli-repl/src/csfle-library-paths.ts b/packages/cli-repl/src/crypt-library-paths.ts similarity index 73% rename from packages/cli-repl/src/csfle-library-paths.ts rename to packages/cli-repl/src/crypt-library-paths.ts index 03a1eea878..c8a08a3ba3 100644 --- a/packages/cli-repl/src/csfle-library-paths.ts +++ b/packages/cli-repl/src/crypt-library-paths.ts @@ -7,8 +7,9 @@ export const SHARED_LIBRARY_SUFFIX = process.platform === 'win32' ? 'dll' : process.platform === 'darwin' ? 'dylib' : 'so'; -export interface CSFLELibraryPathResult { - csflePath?: string; +export interface CryptLibraryPathResult { + cryptSharedLibPath?: string; + csflePath?: string; // Alias, currently still used by the driver expectedVersion?: { version: bigint; versionStr: string }; } @@ -16,16 +17,16 @@ export interface CSFLELibraryPathResult { * Figure out the possible shared library paths for the CSFLE shared library * that we are supposed to use. */ -export async function getCSFLELibraryPaths( +export async function getCryptLibraryPaths( bus: MongoshBus, - pretendProcessExecPathForTesting: string | undefined = undefined): Promise { + pretendProcessExecPathForTesting: string | undefined = undefined): Promise { const execPath = pretendProcessExecPathForTesting ?? process.execPath; - let getCSFLESharedLibraryVersion: typeof import('mongodb-csfle-library-version'); + let getCryptSharedLibraryVersion: typeof import('mongodb-crypt-library-version'); try { - getCSFLESharedLibraryVersion = require('mongodb-csfle-library-version'); + getCryptSharedLibraryVersion = require('mongodb-crypt-library-version'); } catch (err) { - getCSFLESharedLibraryVersion = () => ({ version: BigInt(0), versionStr: '' }); + getCryptSharedLibraryVersion = () => ({ version: BigInt(0), versionStr: '' }); } if (execPath === process.argv[1] || pretendProcessExecPathForTesting) { @@ -33,39 +34,40 @@ export async function getCSFLELibraryPaths( const execPathStat = await fs.stat(execPath); for await (const libraryCandidate of [ // Locations of the shared library in the deb and rpm packages - path.resolve(bindir, '..', 'lib64', `mongosh_csfle_v1.${SHARED_LIBRARY_SUFFIX}`), - path.resolve(bindir, '..', 'lib', `mongosh_csfle_v1.${SHARED_LIBRARY_SUFFIX}`), + path.resolve(bindir, '..', 'lib64', `mongosh_crypt_v1.${SHARED_LIBRARY_SUFFIX}`), + path.resolve(bindir, '..', 'lib', `mongosh_crypt_v1.${SHARED_LIBRARY_SUFFIX}`), // Location of the shared library in the zip and tgz packages - path.resolve(bindir, `mongosh_csfle_v1.${SHARED_LIBRARY_SUFFIX}`) + path.resolve(bindir, `mongosh_crypt_v1.${SHARED_LIBRARY_SUFFIX}`) ]) { try { const permissionsMismatch = await ensureMatchingPermissions(libraryCandidate, execPathStat); if (permissionsMismatch) { - bus.emit('mongosh:csfle-load-skip', { - csflePath: libraryCandidate, + bus.emit('mongosh:crypt-library-load-skip', { + cryptSharedLibPath: libraryCandidate, reason: 'permissions mismatch', details: permissionsMismatch }); continue; } - const version = getCSFLESharedLibraryVersion(libraryCandidate); + const version = getCryptSharedLibraryVersion(libraryCandidate); const result = { + cryptSharedLibPath: libraryCandidate, csflePath: libraryCandidate, expectedVersion: version }; - bus.emit('mongosh:csfle-load-found', result); + bus.emit('mongosh:crypt-library-load-found', result); return result; } catch (err: any) { - bus.emit('mongosh:csfle-load-skip', { - csflePath: libraryCandidate, + bus.emit('mongosh:crypt-library-load-skip', { + cryptSharedLibPath: libraryCandidate, reason: err.message }); } } } else { - bus.emit('mongosh:csfle-load-skip', { - csflePath: '', + bus.emit('mongosh:crypt-library-load-skip', { + cryptSharedLibPath: '', reason: 'Skipping CSFLE library searching because this is not a single-executable mongosh' }); } diff --git a/packages/cli-repl/src/csfle-library-paths.spec.ts b/packages/cli-repl/src/csfle-library-paths.spec.ts deleted file mode 100644 index ee3c80f169..0000000000 --- a/packages/cli-repl/src/csfle-library-paths.spec.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { expect } from 'chai'; -import { SHARED_LIBRARY_SUFFIX, getCSFLELibraryPaths } from './csfle-library-paths'; -import csfleLibraryDummy from 'mongodb-csfle-library-dummy'; -import type { MongoshBus } from '@mongosh/types'; -import { useTmpdir } from '../test/repl-helpers'; -import { EventEmitter } from 'events'; -import { promises as fs } from 'fs'; -import path from 'path'; - -describe('getCSFLELibraryPaths', () => { - let bus: MongoshBus; - let events: any[]; - let fakeMongoshExecPath: string; - const tmpdir = useTmpdir(); - const csfleFilename = `mongosh_csfle_v1.${SHARED_LIBRARY_SUFFIX}`; - const expectedVersion = { version: BigInt('0x0001000000000000'), versionStr: 'mongo_csfle_v1-dummy' }; - - beforeEach(async function() { - events = []; - bus = new EventEmitter(); - bus.on('mongosh:csfle-load-found', (ev) => events.push(['mongosh:csfle-load-found', ev])); - bus.on('mongosh:csfle-load-skip', (ev) => events.push(['mongosh:csfle-load-skip', ev])); - fakeMongoshExecPath = path.join(tmpdir.path, 'bin', 'mongosh'); - await fs.mkdir(path.join(tmpdir.path, 'bin'), { recursive: true }); - await fs.mkdir(path.join(tmpdir.path, 'lib'), { recursive: true }); - await fs.mkdir(path.join(tmpdir.path, 'lib64'), { recursive: true }); - await fs.writeFile(fakeMongoshExecPath, '# dummy', { mode: 0o755 }); - }); - - it('will look up a shared library located in /../lib/', async function() { - const csflePath = path.join(tmpdir.path, 'lib', csfleFilename); - await fs.copyFile(csfleLibraryDummy, csflePath); - expect(await getCSFLELibraryPaths(bus, fakeMongoshExecPath)).to.deep.equal({ - csflePath, - expectedVersion - }); - expect(events.slice(1)).to.deep.equal([ - [ 'mongosh:csfle-load-found', { csflePath, expectedVersion } ] - ]); - }); - - it('will look up a shared library located in /../lib64/', async function() { - const csflePath = path.join(tmpdir.path, 'lib64', csfleFilename); - await fs.copyFile(csfleLibraryDummy, csflePath); - expect(await getCSFLELibraryPaths(bus, fakeMongoshExecPath)).to.deep.equal({ - csflePath, - expectedVersion - }); - expect(events).to.deep.equal([ - [ 'mongosh:csfle-load-found', { csflePath, expectedVersion } ] - ]); - }); - - it('will look up a shared library located in /', async function() { - const csflePath = path.join(tmpdir.path, 'bin', csfleFilename); - await fs.copyFile(csfleLibraryDummy, csflePath); - expect(await getCSFLELibraryPaths(bus, fakeMongoshExecPath)).to.deep.equal({ - csflePath, - expectedVersion - }); - expect(events[0][0]).to.equal('mongosh:csfle-load-skip'); - expect(events[0][1].reason).to.match(/ENOENT|LoadLibraryW failed/); - expect(events.slice(2)).to.deep.equal([ - [ 'mongosh:csfle-load-found', { csflePath, expectedVersion } ] - ]); - }); - - it('will reject a shared library if it is not readable', async function() { - if (process.platform === 'win32') { - return this.skip(); - } - const csflePath = path.join(tmpdir.path, 'lib', csfleFilename); - await fs.copyFile(csfleLibraryDummy, csflePath); - await fs.chmod(csflePath, 0o000); - expect(await getCSFLELibraryPaths(bus, fakeMongoshExecPath)).to.deep.equal({}); - expect(events[1][0]).to.equal('mongosh:csfle-load-skip'); - expect(events[1][1].reason).to.include('EACCES'); - }); - - it('will reject a shared library if its permissions are world-writable', async function() { - if (process.platform === 'win32') { - return this.skip(); - } - const csflePath = path.join(tmpdir.path, 'lib', csfleFilename); - await fs.copyFile(csfleLibraryDummy, csflePath); - await fs.chmod(csflePath, 0o777); - expect(await getCSFLELibraryPaths(bus, fakeMongoshExecPath)).to.deep.equal({}); - expect(events[1][0]).to.equal('mongosh:csfle-load-skip'); - expect(events[1][1].reason).to.include('permissions mismatch'); - }); -}); diff --git a/packages/cli-repl/src/mongosh-repl.ts b/packages/cli-repl/src/mongosh-repl.ts index 470d8aebdc..6c5671b348 100644 --- a/packages/cli-repl/src/mongosh-repl.ts +++ b/packages/cli-repl/src/mongosh-repl.ts @@ -37,7 +37,7 @@ export type MongoshIOProvider = Omit, 'validateCon getHistoryFilePath(): string; exit(code?: number): Promise; readFileUTF8(filename: string): Promise<{ contents: string, absolutePath: string }>; - getCSFLELibraryOptions(): Promise; + getCryptLibraryOptions(): Promise; bugReportErrorMessageInfo?(): string | undefined; }; @@ -855,10 +855,10 @@ class MongoshNodeRepl implements EvaluationListener { } /** - * Get the right CSFLE shared library loading options. + * Get the right crypt shared library loading options. */ - async getCSFLELibraryOptions(): Promise { - return this.ioProvider.getCSFLELibraryOptions(); + async getCryptLibraryOptions(): Promise { + return this.ioProvider.getCryptLibraryOptions(); } /** diff --git a/packages/cli-repl/src/run.ts b/packages/cli-repl/src/run.ts index e2150a9aaa..85182c13e8 100644 --- a/packages/cli-repl/src/run.ts +++ b/packages/cli-repl/src/run.ts @@ -10,7 +10,7 @@ if (process.argv.includes('--tlsFIPSMode')) { import { CliRepl, parseCliArgs, runSmokeTests, USAGE, buildInfo } from './index'; import { getStoragePaths, getGlobalConfigPaths } from './config-directory'; -import { getCSFLELibraryPaths } from './csfle-library-paths'; +import { getCryptLibraryPaths } from './crypt-library-paths'; import { getTlsCertificateSelector } from './tls-certificate-selector'; import { redactURICredentials } from '@mongosh/history'; import { generateConnectionInfoFromCliArgs } from '@mongosh/arg-parser'; @@ -76,15 +76,15 @@ import crypto from 'crypto'; console.log(JSON.stringify(buildInfo(), null, ' ')); } else if (options.smokeTests) { const smokeTestServer = process.env.MONGOSH_SMOKE_TEST_SERVER; - const csfleLibraryOpts = options.csfleLibraryPath ? [ - `--csfleLibraryPath=${options.csfleLibraryPath}` + const cryptLibraryOpts = options.cryptSharedLibPath ? [ + `--cryptSharedLibPath=${options.cryptSharedLibPath}` ] : []; if (process.execPath === process.argv[1]) { // This is the compiled binary. Use only the path to it. - await runSmokeTests(smokeTestServer, process.execPath, ...csfleLibraryOpts); + await runSmokeTests(smokeTestServer, process.execPath, ...cryptLibraryOpts); } else { // This is not the compiled binary. Use node + this script. - await runSmokeTests(smokeTestServer, process.execPath, process.argv[1], ...csfleLibraryOpts); + await runSmokeTests(smokeTestServer, process.execPath, process.argv[1], ...cryptLibraryOpts); } } else { if (process.execPath === process.argv[1]) { @@ -134,7 +134,7 @@ import crypto from 'crypto'; shellCliOptions: { ...options, }, - getCSFLELibraryPaths, + getCryptLibraryPaths, input: process.stdin, output: process.stdout, onExit: process.exit, diff --git a/packages/cli-repl/src/smoke-tests-fle.ts b/packages/cli-repl/src/smoke-tests-fle.ts index 6881cc0a54..c4c2c1068d 100644 --- a/packages/cli-repl/src/smoke-tests-fle.ts +++ b/packages/cli-repl/src/smoke-tests-fle.ts @@ -1,5 +1,5 @@ /** - * Test script that verifies that automatic encryption using the CSFLE shared + * Test script that verifies that automatic encryption using the crypt shared * library works when using the Mongo() object to construct the encryption key and * to create an auto-encryption-aware connection. */ @@ -13,7 +13,7 @@ const assert = function(value, message) { } }; if (process.platform === 'linux' && process.arch === 's390x') { - // There is no CSFLE shared library binary for the rhel72 s390x that we test on. + // There is no crypt shared library binary for the rhel72 s390x that we test on. // We will address this in MONGOSH-862. print('Test skipped') process.exit(0); diff --git a/packages/cli-repl/src/smoke-tests.spec.ts b/packages/cli-repl/src/smoke-tests.spec.ts index 55081fd956..e3c6826bcd 100644 --- a/packages/cli-repl/src/smoke-tests.spec.ts +++ b/packages/cli-repl/src/smoke-tests.spec.ts @@ -1,13 +1,13 @@ import { runSmokeTests } from './'; import path from 'path'; -import { startTestServer, downloadCurrentCsfleSharedLibrary } from '../../../testing/integration-testing-hooks'; +import { startTestServer, downloadCurrentCryptSharedLibrary } from '../../../testing/integration-testing-hooks'; describe('smoke tests', () => { const testServer = startTestServer('shared'); - let csfleLibrary: string; + let cryptLibrary: string; before(async() => { - csfleLibrary = await downloadCurrentCsfleSharedLibrary(); + cryptLibrary = await downloadCurrentCryptSharedLibrary(); }); it('self-test passes', async() => { @@ -15,7 +15,7 @@ describe('smoke tests', () => { // coverage. await runSmokeTests( await testServer.connectionString(), - process.execPath, '-r', 'ts-node/register', path.resolve(__dirname, 'run.ts'), '--csfleLibraryPath', csfleLibrary + process.execPath, '-r', 'ts-node/register', path.resolve(__dirname, 'run.ts'), '--cryptSharedLibPath', cryptLibrary ); }); }); diff --git a/packages/cli-repl/test/e2e-fle.spec.ts b/packages/cli-repl/test/e2e-fle.spec.ts index b625c94ef6..5ac60fd292 100644 --- a/packages/cli-repl/test/e2e-fle.spec.ts +++ b/packages/cli-repl/test/e2e-fle.spec.ts @@ -6,7 +6,7 @@ import { startTestServer, skipIfServerVersion, skipIfCommunityServer, - downloadCurrentCsfleSharedLibrary + downloadCurrentCryptSharedLibrary } from '../../../testing/integration-testing-hooks'; import { makeFakeHTTPServer, fakeAWSHandlers } from '../../../testing/fake-kms'; import { once } from 'events'; @@ -20,19 +20,13 @@ describe('FLE tests', () => { skipIfCommunityServer(testServer); // FLE is enterprise-only let kmsServer: ReturnType; let dbname: string; - let csfleLibrary: string; + let cryptLibrary: string; before(async function() { - if (process.platform === 'linux' && process.arch === 's390x') { - return this.skip(); - // There is no CSFLE shared library binary for the rhel72 s390x that we test on. - // We will address this in MONGOSH-862. - } - kmsServer = makeFakeHTTPServer(fakeAWSHandlers); kmsServer.listen(0); await once(kmsServer, 'listening'); - csfleLibrary = await downloadCurrentCsfleSharedLibrary(); + cryptLibrary = await downloadCurrentCryptSharedLibrary(); }); after(() => { // eslint-disable-next-line chai-friendly/no-unused-expressions @@ -63,7 +57,7 @@ describe('FLE tests', () => { async function makeTestShell(): Promise { return TestShell.start({ args: [ - `--csfleLibraryPath=${csfleLibrary}`, + `--cryptSharedLibPath=${cryptLibrary}`, `--awsAccessKeyId=${accessKeyId}`, `--awsSecretAccessKey=${secretAccessKey}`, `--keyVaultNamespace=${dbname}.keyVault`, @@ -154,7 +148,7 @@ describe('FLE tests', () => { it('works when a schemaMap option has been passed', async() => { const shell = TestShell.start({ - args: ['--nodb', `--csfleLibraryPath=${csfleLibrary}`] + args: ['--nodb', `--cryptSharedLibPath=${cryptLibrary}`] }); await shell.waitForPrompt(); await shell.executeLine('local = { key: BinData(0, "kh4Gv2N8qopZQMQYMEtww/AkPsIrXNmEMxTrs3tUoTQZbZu4msdRUaR8U5fXD7A7QXYHcEvuu4WctJLoT+NvvV3eeIg3MD+K8H9SR794m/safgRHdIfy6PD+rFpvmFbY") }'); @@ -183,7 +177,7 @@ describe('FLE tests', () => { it('skips encryption when a bypassQueryAnalysis option has been passed', async() => { const shell = TestShell.start({ - args: ['--nodb', `--csfleLibraryPath=${csfleLibrary}`] + args: ['--nodb', `--cryptSharedLibPath=${cryptLibrary}`] }); const uri = JSON.stringify(await testServer.connectionString()); @@ -264,7 +258,7 @@ describe('FLE tests', () => { skipIfServerVersion(testServer, '< 6.0'); // FLE2 only available on 6.0+ it('drops fle2 collection with all helper collections when encryptedFields options are in listCollections', async() => { - const shell = TestShell.start({ args: ['--nodb', `--csfleLibraryPath=${csfleLibrary}`] }); + const shell = TestShell.start({ args: ['--nodb', `--cryptSharedLibPath=${cryptLibrary}`] }); const uri = JSON.stringify(await testServer.connectionString()); await shell.waitForPrompt(); @@ -326,7 +320,7 @@ describe('FLE tests', () => { it('allows compactStructuredEncryptionData command when mongo instance configured with auto encryption', async() => { const shell = TestShell.start({ - args: ['--nodb', `--csfleLibraryPath=${csfleLibrary}`] + args: ['--nodb', `--cryptSharedLibPath=${cryptLibrary}`] }); const uri = JSON.stringify(await testServer.connectionString()); @@ -366,7 +360,7 @@ describe('FLE tests', () => { it('performs KeyVault data key management as expected', async() => { const shell = TestShell.start({ - args: [await testServer.connectionString(), `--csfleLibraryPath=${csfleLibrary}`] + args: [await testServer.connectionString(), `--cryptSharedLibPath=${cryptLibrary}`] }); await shell.waitForPrompt(); // Wrapper for executeLine that expects single-line output diff --git a/packages/logging/src/setup-logger-and-telemetry.spec.ts b/packages/logging/src/setup-logger-and-telemetry.spec.ts index a7168dd28f..dfe4e5e869 100644 --- a/packages/logging/src/setup-logger-and-telemetry.spec.ts +++ b/packages/logging/src/setup-logger-and-telemetry.spec.ts @@ -68,8 +68,8 @@ describe('setupLoggerAndTelemetry', () => { bus.emit('mongosh:eval-cli-script'); bus.emit('mongosh:globalconfig-load', { filename: '/etc/mongosh.conf', found: true }); - bus.emit('mongosh:csfle-load-skip', { csflePath: 'path', reason: 'reason' }); - bus.emit('mongosh:csfle-load-found', { csflePath: 'path', expectedVersion: { versionStr: 'someversion' } }); + bus.emit('mongosh:crypt-library-load-skip', { cryptSharedLibPath: 'path', reason: 'reason' }); + bus.emit('mongosh:crypt-library-load-found', { cryptSharedLibPath: 'path', expectedVersion: { versionStr: 'someversion' } }); bus.emit('mongosh-snippets:loaded', { installdir: '/' }); bus.emit('mongosh-snippets:npm-lookup', { existingVersion: 'v1.2.3' }); @@ -155,9 +155,9 @@ describe('setupLoggerAndTelemetry', () => { expect(logOutput[i].msg).to.equal('Loading global configuration file'); expect(logOutput[i++].attr.filename).to.equal('/etc/mongosh.conf'); expect(logOutput[i].msg).to.equal('Skipping shared library candidate'); - expect(logOutput[i++].attr).to.deep.equal({ csflePath: 'path', reason: 'reason' }); + expect(logOutput[i++].attr).to.deep.equal({ cryptSharedLibPath: 'path', reason: 'reason' }); expect(logOutput[i].msg).to.equal('Accepted shared library candidate'); - expect(logOutput[i++].attr).to.deep.equal({ csflePath: 'path', expectedVersion: 'someversion' }); + expect(logOutput[i++].attr).to.deep.equal({ cryptSharedLibPath: 'path', expectedVersion: 'someversion' }); expect(logOutput[i].msg).to.equal('Loaded snippets'); expect(logOutput[i++].attr).to.deep.equal({ installdir: '/' }); expect(logOutput[i].msg).to.equal('Performing npm lookup'); diff --git a/packages/logging/src/setup-logger-and-telemetry.ts b/packages/logging/src/setup-logger-and-telemetry.ts index 27d87d6dde..c5c53a9a06 100644 --- a/packages/logging/src/setup-logger-and-telemetry.ts +++ b/packages/logging/src/setup-logger-and-telemetry.ts @@ -13,8 +13,8 @@ import type { StartLoadingCliScriptsEvent, StartMongoshReplEvent, GlobalConfigFileLoadEvent, - CSFLELibrarySkipEvent, - CSFLELibraryFoundEvent, + CryptLibrarySkipEvent, + CryptLibraryFoundEvent, SnippetsCommandEvent, SnippetsErrorEvent, SnippetsFetchIndexErrorEvent, @@ -272,13 +272,13 @@ export function setupLoggerAndTelemetry( }); }); - bus.on('mongosh:csfle-load-skip', function(ev: CSFLELibrarySkipEvent) { - log.info('CSFLE', mongoLogId(1_000_000_050), 'csfle', 'Skipping shared library candidate', ev); + bus.on('mongosh:crypt-library-load-skip', function(ev: CryptLibrarySkipEvent) { + log.info('AUTO-ENCRYPTION', mongoLogId(1_000_000_050), 'crypt-library', 'Skipping shared library candidate', ev); }); - bus.on('mongosh:csfle-load-found', function(ev: CSFLELibraryFoundEvent) { - log.warn('CSFLE', mongoLogId(1_000_000_051), 'csfle', 'Accepted shared library candidate', { - csflePath: ev.csflePath, + bus.on('mongosh:crypt-library-load-found', function(ev: CryptLibraryFoundEvent) { + log.warn('AUTO-ENCRYPTION', mongoLogId(1_000_000_051), 'crypt-library', 'Accepted shared library candidate', { + cryptSharedLibPath: ev.cryptSharedLibPath, expectedVersion: ev.expectedVersion.versionStr }); }); diff --git a/packages/node-runtime-worker-thread/src/child-process-evaluation-listener.ts b/packages/node-runtime-worker-thread/src/child-process-evaluation-listener.ts index b13e178236..344aed37f9 100644 --- a/packages/node-runtime-worker-thread/src/child-process-evaluation-listener.ts +++ b/packages/node-runtime-worker-thread/src/child-process-evaluation-listener.ts @@ -4,7 +4,7 @@ import type { WorkerRuntime } from './index'; import { RuntimeEvaluationListener } from '@mongosh/browser-runtime-core'; export class ChildProcessEvaluationListener { - exposedListener: Exposed>>; + exposedListener: Exposed>>; constructor(workerRuntime: WorkerRuntime, childProcess: ChildProcess) { this.exposedListener = exposeAll( diff --git a/packages/shell-api/src/mongo.ts b/packages/shell-api/src/mongo.ts index 1b3e14b54b..755048c172 100644 --- a/packages/shell-api/src/mongo.ts +++ b/packages/shell-api/src/mongo.ts @@ -192,7 +192,7 @@ export default class Mongo extends ShellApiClass { } else if (driverOptions.autoEncryption) { driverOptions.autoEncryption.extraOptions = { ...driverOptions.autoEncryption.extraOptions, - ...await this._instanceState.evaluationListener?.getCSFLELibraryOptions?.() + ...await this._instanceState.evaluationListener?.getCryptLibraryOptions?.() }; } const parentProvider = this._instanceState.initialServiceProvider; diff --git a/packages/shell-api/src/shell-instance-state.ts b/packages/shell-api/src/shell-instance-state.ts index 588cd0876d..ceb561de93 100644 --- a/packages/shell-api/src/shell-instance-state.ts +++ b/packages/shell-api/src/shell-instance-state.ts @@ -98,10 +98,10 @@ export interface EvaluationListener extends Partial Promise; + getCryptLibraryOptions?: () => Promise; } /** diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 2482d2b349..b5052649b7 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -77,14 +77,14 @@ export interface GlobalConfigFileLoadEvent { found: boolean; } -export interface CSFLELibrarySkipEvent { - csflePath: string; +export interface CryptLibrarySkipEvent { + cryptSharedLibPath: string; reason: string; details?: any; } -export interface CSFLELibraryFoundEvent { - csflePath: string; +export interface CryptLibraryFoundEvent { + cryptSharedLibPath: string; expectedVersion: { versionStr: string }; } @@ -261,13 +261,13 @@ export interface MongoshBusEventsMap extends ConnectEventMap { */ 'mongosh:eval-interrupted': () => void; /** - * Signals that a potential CSFLE library search path was skipped. + * Signals that a potential crypt library search path was skipped. */ - 'mongosh:csfle-load-skip': (ev: CSFLELibrarySkipEvent) => void; + 'mongosh:crypt-library-load-skip': (ev: CryptLibrarySkipEvent) => void; /** - * Signals that a potential CSFLE library search path was accepted. + * Signals that a potential crypt library search path was accepted. */ - 'mongosh:csfle-load-found': (ev: CSFLELibraryFoundEvent) => void; + 'mongosh:crypt-library-load-found': (ev: CryptLibraryFoundEvent) => void; /** * Signals that the CLI REPL's `close` method has completed. * _ONLY AVAILABLE FOR TESTING._ diff --git a/packaging/README b/packaging/README index d8192b64e6..855c552942 100644 --- a/packaging/README +++ b/packaging/README @@ -1,5 +1,5 @@ This package contains `mongosh`, the mongo shell. -Additionally, it includes a shared library, `mongosh_csfle_v1`, as well as a +Additionally, it includes a shared library, `mongosh_crypt_v1`, as well as a manual page `mongosh.1.gz` that can be viewed using the `man` command line utility, and their respective licensing files. @@ -8,4 +8,4 @@ Extract them to a suitable location. For licensing information: - mongosh: See LICENSE-mongosh -- mongosh_csfle_v1: See LICENSE-csfle +- mongosh_crypt_v1: See LICENSE-crypt-library diff --git a/packaging/msi-template/README.md b/packaging/msi-template/README.md index 0f53a0d089..fe578ad30a 100644 --- a/packaging/msi-template/README.md +++ b/packaging/msi-template/README.md @@ -16,4 +16,4 @@ Build by executing commands: - BuildFolder: Folder containing the binaries and license notices. Defaults to "..\\..\mongosh-_Version_-dev.0-win32" # Open Issues -1. mongosh.exe and mongosh_csfle_v1.dll should have a version numbers +1. mongosh.exe and mongosh_crypt_v1.dll should have a version numbers diff --git a/scripts/docker/amazonlinux1-rpm.Dockerfile b/scripts/docker/amazonlinux1-rpm.Dockerfile index bb1c7992af..ce783bdd34 100644 --- a/scripts/docker/amazonlinux1-rpm.Dockerfile +++ b/scripts/docker/amazonlinux1-rpm.Dockerfile @@ -2,9 +2,9 @@ FROM amazonlinux:1 ARG artifact_url="" ADD ${artifact_url} /tmp -ADD node_modules /usr/share/mongodb-csfle-library-version/node_modules +ADD node_modules /usr/share/mongodb-crypt-library-version/node_modules RUN yum repolist RUN yum install -y /tmp/*mongosh*.rpm RUN /usr/bin/mongosh --version -RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-csfle-library-version/node_modules/.bin/mongodb-csfle-library-version /usr/lib64/mongosh_csfle_v1.so | grep -q ^mongo_csfle_v1- +RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-crypt-library-version/node_modules/.bin/mongodb-crypt-library-version /usr/lib64/mongosh_crypt_v1.so | grep -Eq '^mongo_(crypt|csfle)_v1-' ENTRYPOINT [ "mongosh" ] diff --git a/scripts/docker/amazonlinux2-rpm.Dockerfile b/scripts/docker/amazonlinux2-rpm.Dockerfile index 49b4600080..15782dc889 100644 --- a/scripts/docker/amazonlinux2-rpm.Dockerfile +++ b/scripts/docker/amazonlinux2-rpm.Dockerfile @@ -2,9 +2,9 @@ FROM amazonlinux:2 ARG artifact_url="" ADD ${artifact_url} /tmp -ADD node_modules /usr/share/mongodb-csfle-library-version/node_modules +ADD node_modules /usr/share/mongodb-crypt-library-version/node_modules RUN yum repolist RUN yum install -y /tmp/*mongosh*.rpm RUN /usr/bin/mongosh --version -RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-csfle-library-version/node_modules/.bin/mongodb-csfle-library-version /usr/lib64/mongosh_csfle_v1.so | grep -q ^mongo_csfle_v1- +RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-crypt-library-version/node_modules/.bin/mongodb-crypt-library-version /usr/lib64/mongosh_crypt_v1.so | grep -Eq '^mongo_(crypt|csfle)_v1-' ENTRYPOINT [ "mongosh" ] diff --git a/scripts/docker/build.sh b/scripts/docker/build.sh index 2481e4a27e..d545c5ef30 100755 --- a/scripts/docker/build.sh +++ b/scripts/docker/build.sh @@ -4,7 +4,7 @@ set -e cd "$(dirname "$0")" # Used for verifying that we actually have a working csfle shared library -[ -x node_modules/mongodb-csfle-library-version ] || npm install +[ -x node_modules/mongodb-crypt-library-version ] || npm install if [ x"$ARTIFACT_URL" = x"" ]; then SHA=`git rev-parse origin/main` diff --git a/scripts/docker/centos7-epel-rpm.Dockerfile b/scripts/docker/centos7-epel-rpm.Dockerfile index 10b1b654cc..25d2415f15 100644 --- a/scripts/docker/centos7-epel-rpm.Dockerfile +++ b/scripts/docker/centos7-epel-rpm.Dockerfile @@ -2,12 +2,12 @@ FROM centos:7 ARG artifact_url="" ADD ${artifact_url} /tmp -ADD node_modules /usr/share/mongodb-csfle-library-version/node_modules +ADD node_modules /usr/share/mongodb-crypt-library-version/node_modules RUN yum repolist # epel-release so that openssl11 is installable RUN yum install -y epel-release RUN yum repolist RUN yum install -y /tmp/*mongosh*.rpm RUN /usr/bin/mongosh --version -RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-csfle-library-version/node_modules/.bin/mongodb-csfle-library-version /usr/lib64/mongosh_csfle_v1.so | grep -q ^mongo_csfle_v1- +RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-crypt-library-version/node_modules/.bin/mongodb-crypt-library-version /usr/lib64/mongosh_crypt_v1.so | grep -Eq '^mongo_(crypt|csfle)_v1-' ENTRYPOINT [ "mongosh" ] diff --git a/scripts/docker/centos7-rpm.Dockerfile b/scripts/docker/centos7-rpm.Dockerfile index 98357e6efb..ae39c23ddd 100644 --- a/scripts/docker/centos7-rpm.Dockerfile +++ b/scripts/docker/centos7-rpm.Dockerfile @@ -2,9 +2,9 @@ FROM centos:7 ARG artifact_url="" ADD ${artifact_url} /tmp -ADD node_modules /usr/share/mongodb-csfle-library-version/node_modules +ADD node_modules /usr/share/mongodb-crypt-library-version/node_modules RUN yum repolist RUN yum install -y /tmp/*mongosh*.rpm RUN /usr/bin/mongosh --version -RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-csfle-library-version/node_modules/.bin/mongodb-csfle-library-version /usr/lib64/mongosh_csfle_v1.so | grep -q ^mongo_csfle_v1- +RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-crypt-library-version/node_modules/.bin/mongodb-crypt-library-version /usr/lib64/mongosh_crypt_v1.so | grep -Eq '^mongo_(crypt|csfle)_v1-' ENTRYPOINT [ "mongosh" ] diff --git a/scripts/docker/debian10-deb.Dockerfile b/scripts/docker/debian10-deb.Dockerfile index 93aca5c0a0..fa06c58484 100644 --- a/scripts/docker/debian10-deb.Dockerfile +++ b/scripts/docker/debian10-deb.Dockerfile @@ -2,11 +2,11 @@ FROM debian:10 ARG artifact_url="" ADD ${artifact_url} /tmp -ADD node_modules /usr/share/mongodb-csfle-library-version/node_modules +ADD node_modules /usr/share/mongodb-crypt-library-version/node_modules RUN apt-get update RUN apt-get install -y man-db RUN apt-get install -y /tmp/*mongosh*.deb RUN /usr/bin/mongosh --version -RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-csfle-library-version/node_modules/.bin/mongodb-csfle-library-version /usr/lib/mongosh_csfle_v1.so | grep -q ^mongo_csfle_v1- +RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-crypt-library-version/node_modules/.bin/mongodb-crypt-library-version /usr/lib/mongosh_crypt_v1.so | grep -Eq '^mongo_(crypt|csfle)_v1-' RUN man mongosh | grep -q tlsAllowInvalidCertificates ENTRYPOINT [ "mongosh" ] diff --git a/scripts/docker/debian11-deb.Dockerfile b/scripts/docker/debian11-deb.Dockerfile index 2195fa035b..bf4c733321 100644 --- a/scripts/docker/debian11-deb.Dockerfile +++ b/scripts/docker/debian11-deb.Dockerfile @@ -2,11 +2,11 @@ FROM debian:11 ARG artifact_url="" ADD ${artifact_url} /tmp -ADD node_modules /usr/share/mongodb-csfle-library-version/node_modules +ADD node_modules /usr/share/mongodb-crypt-library-version/node_modules RUN apt-get update RUN apt-get install -y man-db RUN apt-get install -y /tmp/*mongosh*.deb RUN /usr/bin/mongosh --version -RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-csfle-library-version/node_modules/.bin/mongodb-csfle-library-version /usr/lib/mongosh_csfle_v1.so | grep -q ^mongo_csfle_v1- +RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-crypt-library-version/node_modules/.bin/mongodb-crypt-library-version /usr/lib/mongosh_crypt_v1.so | grep -Eq '^mongo_(crypt|csfle)_v1-' RUN man mongosh | grep -q tlsAllowInvalidCertificates ENTRYPOINT [ "mongosh" ] diff --git a/scripts/docker/debian9-deb.Dockerfile b/scripts/docker/debian9-deb.Dockerfile index e52b8be024..7d99480684 100644 --- a/scripts/docker/debian9-deb.Dockerfile +++ b/scripts/docker/debian9-deb.Dockerfile @@ -2,11 +2,11 @@ FROM debian:9 ARG artifact_url="" ADD ${artifact_url} /tmp -ADD node_modules /usr/share/mongodb-csfle-library-version/node_modules +ADD node_modules /usr/share/mongodb-crypt-library-version/node_modules RUN apt-get update RUN apt-get install -y man-db RUN apt-get install -y /tmp/*mongosh*.deb RUN /usr/bin/mongosh --version -RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-csfle-library-version/node_modules/.bin/mongodb-csfle-library-version /usr/lib/mongosh_csfle_v1.so | grep -q ^mongo_csfle_v1- +RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-crypt-library-version/node_modules/.bin/mongodb-crypt-library-version /usr/lib/mongosh_crypt_v1.so | grep -Eq '^mongo_(crypt|csfle)_v1-' RUN man mongosh | grep -q tlsAllowInvalidCertificates ENTRYPOINT [ "mongosh" ] diff --git a/scripts/docker/fedora34-rpm.Dockerfile b/scripts/docker/fedora34-rpm.Dockerfile index 1ef873e211..4fd5c71245 100644 --- a/scripts/docker/fedora34-rpm.Dockerfile +++ b/scripts/docker/fedora34-rpm.Dockerfile @@ -2,10 +2,10 @@ FROM fedora:34 ARG artifact_url="" ADD ${artifact_url} /tmp -ADD node_modules /usr/share/mongodb-csfle-library-version/node_modules +ADD node_modules /usr/share/mongodb-crypt-library-version/node_modules RUN yum repolist RUN yum install -y man RUN yum install -y /tmp/*mongosh*.rpm RUN /usr/bin/mongosh --version -RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-csfle-library-version/node_modules/.bin/mongodb-csfle-library-version /usr/lib64/mongosh_csfle_v1.so | grep -q ^mongo_csfle_v1- +RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-crypt-library-version/node_modules/.bin/mongodb-crypt-library-version /usr/lib64/mongosh_crypt_v1.so | grep -Eq '^mongo_(crypt|csfle)_v1-' ENTRYPOINT [ "mongosh" ] diff --git a/scripts/docker/package-lock.json b/scripts/docker/package-lock.json index a9413991d1..6251d62bda 100644 --- a/scripts/docker/package-lock.json +++ b/scripts/docker/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.0-dev.0", "license": "Apache-2.0", "dependencies": { - "mongodb-csfle-library-version": "^1.0.2" + "mongodb-crypt-library-version": "^1.0.3" }, "engines": { "node": ">=12.4.0" @@ -28,17 +28,17 @@ "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" }, - "node_modules/mongodb-csfle-library-version": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/mongodb-csfle-library-version/-/mongodb-csfle-library-version-1.0.2.tgz", - "integrity": "sha512-DzO4BDGh8nQUEjr7HcB9w1K1CZlfWQRA1Rkq1ROk8aJoaaEK2m++cyVHVUNzHGrYu7X1r5yqHlGxfPw5bSEU0w==", + "node_modules/mongodb-crypt-library-version": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/mongodb-crypt-library-version/-/mongodb-crypt-library-version-1.0.3.tgz", + "integrity": "sha512-w+T89kF9fC7npcf7m/+OUeXasf5TSL0GlugOCxzdXQFykV5MdU2yvcuuDZz4MD1pJickvGxBcw41jGg2s4lJ0g==", "hasInstallScript": true, "dependencies": { "bindings": "^1.5.0", "node-addon-api": "^4.3.0" }, "bin": { - "mongodb-csfle-library-version": "bin/mongodb-csfle-library-version.js" + "mongodb-crypt-library-version": "bin/mongodb-crypt-library-version.js" } }, "node_modules/node-addon-api": { @@ -61,10 +61,10 @@ "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" }, - "mongodb-csfle-library-version": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/mongodb-csfle-library-version/-/mongodb-csfle-library-version-1.0.2.tgz", - "integrity": "sha512-DzO4BDGh8nQUEjr7HcB9w1K1CZlfWQRA1Rkq1ROk8aJoaaEK2m++cyVHVUNzHGrYu7X1r5yqHlGxfPw5bSEU0w==", + "mongodb-crypt-library-version": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/mongodb-crypt-library-version/-/mongodb-crypt-library-version-1.0.3.tgz", + "integrity": "sha512-w+T89kF9fC7npcf7m/+OUeXasf5TSL0GlugOCxzdXQFykV5MdU2yvcuuDZz4MD1pJickvGxBcw41jGg2s4lJ0g==", "requires": { "bindings": "^1.5.0", "node-addon-api": "^4.3.0" diff --git a/scripts/docker/package.json b/scripts/docker/package.json index 3a17cca486..d6fd278931 100644 --- a/scripts/docker/package.json +++ b/scripts/docker/package.json @@ -21,6 +21,6 @@ "node": ">=12.4.0" }, "dependencies": { - "mongodb-csfle-library-version": "^1.0.2" + "mongodb-crypt-library-version": "^1.0.3" } } diff --git a/scripts/docker/rocky8-epel-rpm.Dockerfile b/scripts/docker/rocky8-epel-rpm.Dockerfile index ff09b7c434..73eb7ac1d9 100644 --- a/scripts/docker/rocky8-epel-rpm.Dockerfile +++ b/scripts/docker/rocky8-epel-rpm.Dockerfile @@ -2,7 +2,7 @@ FROM rockylinux:8 ARG artifact_url="" ADD ${artifact_url} /tmp -ADD node_modules /usr/share/mongodb-csfle-library-version/node_modules +ADD node_modules /usr/share/mongodb-crypt-library-version/node_modules RUN dnf update -y # epel-release so that openssl3 is installable RUN dnf install -y epel-release @@ -10,6 +10,6 @@ RUN dnf repolist RUN dnf install -y man RUN dnf install -y /tmp/*mongosh*.rpm RUN /usr/bin/mongosh --version -RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-csfle-library-version/node_modules/.bin/mongodb-csfle-library-version /usr/lib64/mongosh_csfle_v1.so | grep -q ^mongo_csfle_v1- +RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-crypt-library-version/node_modules/.bin/mongodb-crypt-library-version /usr/lib64/mongosh_crypt_v1.so | grep -Eq '^mongo_(crypt|csfle)_v1-' RUN man mongosh | grep -q tlsAllowInvalidCertificates ENTRYPOINT [ "mongosh" ] diff --git a/scripts/docker/rocky8-rpm.Dockerfile b/scripts/docker/rocky8-rpm.Dockerfile index 3500dbdd9e..e29da9024c 100644 --- a/scripts/docker/rocky8-rpm.Dockerfile +++ b/scripts/docker/rocky8-rpm.Dockerfile @@ -2,11 +2,11 @@ FROM rockylinux:8 ARG artifact_url="" ADD ${artifact_url} /tmp -ADD node_modules /usr/share/mongodb-csfle-library-version/node_modules +ADD node_modules /usr/share/mongodb-crypt-library-version/node_modules RUN dnf repolist RUN dnf install -y man RUN dnf install -y /tmp/*mongosh*.rpm RUN /usr/bin/mongosh --version -RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-csfle-library-version/node_modules/.bin/mongodb-csfle-library-version /usr/lib64/mongosh_csfle_v1.so | grep -q ^mongo_csfle_v1- +RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-crypt-library-version/node_modules/.bin/mongodb-crypt-library-version /usr/lib64/mongosh_crypt_v1.so | grep -Eq '^mongo_(crypt|csfle)_v1-' RUN man mongosh | grep -q tlsAllowInvalidCertificates ENTRYPOINT [ "mongosh" ] diff --git a/scripts/docker/suse12-rpm.Dockerfile b/scripts/docker/suse12-rpm.Dockerfile index 78fa079138..a6fc3be0ba 100644 --- a/scripts/docker/suse12-rpm.Dockerfile +++ b/scripts/docker/suse12-rpm.Dockerfile @@ -2,10 +2,10 @@ FROM registry.suse.com/suse/sles12sp4 ARG artifact_url="" ADD ${artifact_url} /tmp -ADD node_modules /usr/share/mongodb-csfle-library-version/node_modules +ADD node_modules /usr/share/mongodb-crypt-library-version/node_modules RUN zypper --no-gpg-checks --non-interactive addrepo https://download.opensuse.org/repositories/openSUSE:Leap:15.1:Update/standard/openSUSE:Leap:15.1:Update.repo RUN zypper --no-gpg-checks --non-interactive refresh RUN zypper --no-gpg-checks --non-interactive install /tmp/*mongosh*.rpm RUN /usr/bin/mongosh --version -RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-csfle-library-version/node_modules/.bin/mongodb-csfle-library-version /usr/lib64/mongosh_csfle_v1.so | grep -q ^mongo_csfle_v1- +RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-crypt-library-version/node_modules/.bin/mongodb-crypt-library-version /usr/lib64/mongosh_crypt_v1.so | grep -Eq '^mongo_(crypt|csfle)_v1-' ENTRYPOINT [ "mongosh" ] diff --git a/scripts/docker/suse15-rpm.Dockerfile b/scripts/docker/suse15-rpm.Dockerfile index c5164b9df5..335aff737d 100644 --- a/scripts/docker/suse15-rpm.Dockerfile +++ b/scripts/docker/suse15-rpm.Dockerfile @@ -2,12 +2,12 @@ FROM registry.suse.com/suse/sle15 ARG artifact_url="" ADD ${artifact_url} /tmp -ADD node_modules /usr/share/mongodb-csfle-library-version/node_modules +ADD node_modules /usr/share/mongodb-crypt-library-version/node_modules RUN zypper --no-gpg-checks --non-interactive addrepo https://download.opensuse.org/repositories/openSUSE:Leap:15.1:Update/standard/openSUSE:Leap:15.1:Update.repo RUN zypper --no-gpg-checks --non-interactive refresh RUN zypper --no-gpg-checks --non-interactive install man RUN zypper --no-gpg-checks --non-interactive install /tmp/*mongosh*.rpm RUN /usr/bin/mongosh --version -RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-csfle-library-version/node_modules/.bin/mongodb-csfle-library-version /usr/lib64/mongosh_csfle_v1.so | grep -q ^mongo_csfle_v1- +RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-crypt-library-version/node_modules/.bin/mongodb-crypt-library-version /usr/lib64/mongosh_crypt_v1.so | grep -Eq '^mongo_(crypt|csfle)_v1-' RUN man mongosh | grep -q tlsAllowInvalidCertificates ENTRYPOINT [ "mongosh" ] diff --git a/scripts/docker/ubuntu18.04-deb.Dockerfile b/scripts/docker/ubuntu18.04-deb.Dockerfile index 4c956b61a8..c566b1acec 100644 --- a/scripts/docker/ubuntu18.04-deb.Dockerfile +++ b/scripts/docker/ubuntu18.04-deb.Dockerfile @@ -2,9 +2,9 @@ FROM ubuntu:18.04 ARG artifact_url="" ADD ${artifact_url} /tmp -ADD node_modules /usr/share/mongodb-csfle-library-version/node_modules +ADD node_modules /usr/share/mongodb-crypt-library-version/node_modules RUN apt-get update RUN apt-get install -y /tmp/*mongosh*.deb RUN /usr/bin/mongosh --version -RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-csfle-library-version/node_modules/.bin/mongodb-csfle-library-version /usr/lib/mongosh_csfle_v1.so | grep -q ^mongo_csfle_v1- +RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-crypt-library-version/node_modules/.bin/mongodb-crypt-library-version /usr/lib/mongosh_crypt_v1.so | grep -Eq '^mongo_(crypt|csfle)_v1-' ENTRYPOINT [ "mongosh" ] diff --git a/scripts/docker/ubuntu20.04-deb.Dockerfile b/scripts/docker/ubuntu20.04-deb.Dockerfile index 2374d05fa8..1039d04beb 100644 --- a/scripts/docker/ubuntu20.04-deb.Dockerfile +++ b/scripts/docker/ubuntu20.04-deb.Dockerfile @@ -2,12 +2,12 @@ FROM ubuntu:20.04 ARG artifact_url="" ADD ${artifact_url} /tmp -ADD node_modules /usr/share/mongodb-csfle-library-version/node_modules +ADD node_modules /usr/share/mongodb-crypt-library-version/node_modules RUN apt-get update RUN yes | unminimize RUN apt-get install -y man-db RUN apt-get install -y /tmp/*mongosh*.deb RUN /usr/bin/mongosh --version -RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-csfle-library-version/node_modules/.bin/mongodb-csfle-library-version /usr/lib/mongosh_csfle_v1.so | grep -q ^mongo_csfle_v1- +RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-crypt-library-version/node_modules/.bin/mongodb-crypt-library-version /usr/lib/mongosh_crypt_v1.so | grep -Eq '^mongo_(crypt|csfle)_v1-' RUN man mongosh | grep -q tlsAllowInvalidCertificates ENTRYPOINT [ "mongosh" ] diff --git a/scripts/docker/ubuntu20.04-tgz.Dockerfile b/scripts/docker/ubuntu20.04-tgz.Dockerfile index 9699588dfa..f65885d97d 100644 --- a/scripts/docker/ubuntu20.04-tgz.Dockerfile +++ b/scripts/docker/ubuntu20.04-tgz.Dockerfile @@ -2,11 +2,11 @@ FROM ubuntu:20.04 ARG artifact_url="" ADD ${artifact_url} /tmp -ADD node_modules /usr/share/mongodb-csfle-library-version/node_modules +ADD node_modules /usr/share/mongodb-crypt-library-version/node_modules RUN apt-get update RUN apt-get install -y libgssapi-krb5-2 RUN tar -C /tmp --strip-components=1 -xvzf /tmp/*mongosh*.tgz RUN ln -s /tmp/bin/mongosh /usr/bin/mongosh RUN /usr/bin/mongosh --version -RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-csfle-library-version/node_modules/.bin/mongodb-csfle-library-version /tmp/bin/mongosh_csfle_v1.so | grep -q ^mongo_csfle_v1- +RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-crypt-library-version/node_modules/.bin/mongodb-crypt-library-version /tmp/bin/mongosh_crypt_v1.so | grep -Eq '^mongo_(crypt|csfle)_v1-' ENTRYPOINT [ "mongosh" ] diff --git a/scripts/docker/ubuntu22.04-deb.Dockerfile b/scripts/docker/ubuntu22.04-deb.Dockerfile index 16763f7739..c799278dea 100644 --- a/scripts/docker/ubuntu22.04-deb.Dockerfile +++ b/scripts/docker/ubuntu22.04-deb.Dockerfile @@ -2,12 +2,12 @@ FROM ubuntu:22.04 ARG artifact_url="" ADD ${artifact_url} /tmp -ADD node_modules /usr/share/mongodb-csfle-library-version/node_modules +ADD node_modules /usr/share/mongodb-crypt-library-version/node_modules RUN apt-get update RUN yes | unminimize RUN apt-get install -y man-db RUN apt-get install -y /tmp/*mongosh*.deb RUN /usr/bin/mongosh --version -RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-csfle-library-version/node_modules/.bin/mongodb-csfle-library-version /usr/lib/mongosh_csfle_v1.so | grep -q ^mongo_csfle_v1- +RUN env MONGOSH_RUN_NODE_SCRIPT=1 mongosh /usr/share/mongodb-crypt-library-version/node_modules/.bin/mongodb-crypt-library-version /usr/lib/mongosh_crypt_v1.so | grep -Eq '^mongo_(crypt|csfle)_v1-' RUN man mongosh | grep -q tlsAllowInvalidCertificates ENTRYPOINT [ "mongosh" ] diff --git a/testing/integration-testing-hooks.ts b/testing/integration-testing-hooks.ts index ecf4f87d15..9bc89be0d8 100644 --- a/testing/integration-testing-hooks.ts +++ b/testing/integration-testing-hooks.ts @@ -10,7 +10,7 @@ import { URL } from 'url'; import { promisify } from 'util'; import which from 'which'; import { downloadMongoDb } from '../packages/build/src/download-mongodb'; -import { downloadCsfleLibrary } from '../packages/build/src/packaging/download-csfle-library'; +import { downloadCryptLibrary } from '../packages/build/src/packaging/download-crypt-library'; const execFile = promisify(child_process.execFile); @@ -390,11 +390,11 @@ export async function ensureMongodAvailable(mongodVersion = process.env.MONGOSH_ } } -export async function downloadCurrentCsfleSharedLibrary(): Promise { +export async function downloadCurrentCryptSharedLibrary(): Promise { if (process.platform === 'linux') { - return await downloadCsfleLibrary(`linux-${process.arch.replace('ppc64', 'ppc64le')}` as any); + return await downloadCryptLibrary(`linux-${process.arch.replace('ppc64', 'ppc64le')}` as any); } - return downloadCsfleLibrary('host'); + return downloadCryptLibrary('host'); } /**