From bc8f5dc2103945d5bf8099f469d1d092e57a33ec Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Fri, 17 Nov 2017 21:30:23 +0100 Subject: [PATCH] COMPASS-1868: Validate database names with '.' in them --- .../database-ddl/lib/store/create-database-store.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/internal-plugins/database-ddl/lib/store/create-database-store.js b/src/internal-plugins/database-ddl/lib/store/create-database-store.js index 6a88f11bd93..619a060c9cf 100644 --- a/src/internal-plugins/database-ddl/lib/store/create-database-store.js +++ b/src/internal-plugins/database-ddl/lib/store/create-database-store.js @@ -31,6 +31,9 @@ const CreateDatabaseStore = Reflux.createStore({ * @param {Number} size - The max size of the capped collection. */ createDatabase(dbName, collection, capped, size) { + if (dbName.includes('.')) { + return this.handleResult(new Error('Database names may not contain a "."'), null); + } const options = capped ? { capped: true, size: parseInt(size, 10) } : {}; try { this.dataService.createCollection(`${dbName}.${collection}`, options, this.handleResult.bind(this));