mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-25 06:36:34 +00:00
refactor: review comments
This commit is contained in:
@@ -12,9 +12,19 @@ const logger = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const decryptConfig = async (encryptedConfig: string, secret: string) => {
|
const decryptConfig = async (encryptedConfig: string, secret: string) => {
|
||||||
return CryptoJS.AES.decrypt(encryptedConfig, secret).toString(
|
if (!encryptedConfig) return encryptedConfig;
|
||||||
|
|
||||||
|
const decryptedVal = CryptoJS.AES.decrypt(encryptedConfig, secret).toString(
|
||||||
CryptoJS.enc.Utf8,
|
CryptoJS.enc.Utf8,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// validate by parsing JSON
|
||||||
|
try {
|
||||||
|
JSON.parse(decryptedVal);
|
||||||
|
} catch {
|
||||||
|
throw new Error('Config decryption failed');
|
||||||
|
}
|
||||||
|
return decryptedVal;
|
||||||
};
|
};
|
||||||
|
|
||||||
// decrypt datasource details in source table and integration table
|
// decrypt datasource details in source table and integration table
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
const packageJsonPath =path.join(__dirname, '..', 'packages', 'nc-secret-cli', 'package.json')
|
const packageJsonPath = path.join(__dirname, '..', 'packages', 'nc-secret-cli', 'package.json')
|
||||||
|
|
||||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user