mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 17:46:00 +00:00
SYNC: Merge branch 'feature/firestore'
This commit is contained in:
committed by
Diflow
parent
b12587626d
commit
ca145967dc
@@ -101,24 +101,26 @@ function decryptObjectPasswordField(obj, field, encryptor = null) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
const fieldsToEncrypt = ['password', 'sshPassword', 'sshKeyfilePassword', 'connectionDefinition'];
|
||||
|
||||
function encryptConnection(connection, encryptor = null) {
|
||||
if (connection.passwordMode != 'saveRaw') {
|
||||
connection = encryptObjectPasswordField(connection, 'password', encryptor);
|
||||
connection = encryptObjectPasswordField(connection, 'sshPassword', encryptor);
|
||||
connection = encryptObjectPasswordField(connection, 'sshKeyfilePassword', encryptor);
|
||||
for (const field of fieldsToEncrypt) {
|
||||
connection = encryptObjectPasswordField(connection, field, encryptor);
|
||||
}
|
||||
}
|
||||
return connection;
|
||||
}
|
||||
|
||||
function maskConnection(connection) {
|
||||
if (!connection) return connection;
|
||||
return _.omit(connection, ['password', 'sshPassword', 'sshKeyfilePassword']);
|
||||
return _.omit(connection, fieldsToEncrypt);
|
||||
}
|
||||
|
||||
function decryptConnection(connection, encryptor = null) {
|
||||
connection = decryptObjectPasswordField(connection, 'password', encryptor);
|
||||
connection = decryptObjectPasswordField(connection, 'sshPassword', encryptor);
|
||||
connection = decryptObjectPasswordField(connection, 'sshKeyfilePassword', encryptor);
|
||||
function decryptConnection(connection) {
|
||||
for (const field of fieldsToEncrypt) {
|
||||
connection = decryptObjectPasswordField(connection, field);
|
||||
}
|
||||
return connection;
|
||||
}
|
||||
|
||||
@@ -188,9 +190,9 @@ function recryptObjectPasswordFieldInPlace(obj, field, decryptEncryptor, encrypt
|
||||
}
|
||||
|
||||
function recryptConnection(connection, decryptEncryptor, encryptEncryptor) {
|
||||
connection = recryptObjectPasswordField(connection, 'password', decryptEncryptor, encryptEncryptor);
|
||||
connection = recryptObjectPasswordField(connection, 'sshPassword', decryptEncryptor, encryptEncryptor);
|
||||
connection = recryptObjectPasswordField(connection, 'sshKeyfilePassword', decryptEncryptor, encryptEncryptor);
|
||||
for (const field of fieldsToEncrypt) {
|
||||
connection = recryptObjectPasswordField(connection, field, decryptEncryptor, encryptEncryptor);
|
||||
}
|
||||
return connection;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user