From 9f2ec0138435bfbb799bb9af113671e5a58d47aa Mon Sep 17 00:00:00 2001 From: Pranav C <61551451+pranavxc@users.noreply.github.com> Date: Thu, 8 Jul 2021 21:06:43 +0530 Subject: [PATCH] fix: Remove credentials from project info API Signed-off-by: Pranav C <61551451+pranavxc@users.noreply.github.com> --- packages/nocodb/src/lib/sqlMgr/SqlMgr.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/nocodb/src/lib/sqlMgr/SqlMgr.ts b/packages/nocodb/src/lib/sqlMgr/SqlMgr.ts index 92c6393b2e..ca5c355268 100644 --- a/packages/nocodb/src/lib/sqlMgr/SqlMgr.ts +++ b/packages/nocodb/src/lib/sqlMgr/SqlMgr.ts @@ -172,6 +172,7 @@ export default class SqlMgr { args.folder = slash(this.currentProjectFolder); const projectJson = {...this.currentProjectJson, envs: {...this.currentProjectJson.envs}}; + // delete db credentials for (const env of Object.keys(projectJson.envs)) { projectJson.envs[env] = {...projectJson.envs[env], db: [...projectJson.envs[env].db]} for (let i = 0; i < projectJson.envs[env].db.length; i++) { @@ -181,10 +182,16 @@ export default class SqlMgr { database: projectJson.envs[env].db[i].connection.database } } - } } + + // remove meta db credentials + if (projectJson.meta?.db) delete projectJson.meta.db; + + // remove auth credentials + delete projectJson.auth; + args.projectJson = projectJson; data.data.list[0] = args; return data; @@ -1065,7 +1072,6 @@ export default class SqlMgr { } - public async projectChangeEnv(args) { try { const xcConfig = JSON.parse(fs.readFileSync(path.join(this.currentProjectFolder, 'config.xc.json'), 'utf8'));