validate encryption password separately
This commit is contained in:
+4
-13
@@ -24,8 +24,8 @@ exports = module.exports = {
|
||||
setSnapshotInfo,
|
||||
|
||||
validatePolicy,
|
||||
validateEncryptionPassword,
|
||||
testConfig,
|
||||
testProviderConfig,
|
||||
|
||||
remount,
|
||||
getMountStatus,
|
||||
@@ -340,22 +340,13 @@ async function testConfig(backupConfig) {
|
||||
|
||||
if (backupConfig.format !== 'tgz' && backupConfig.format !== 'rsync') return new BoxError(BoxError.BAD_FIELD, 'unknown format');
|
||||
|
||||
if ('password' in backupConfig) {
|
||||
if (typeof backupConfig.password !== 'string') return new BoxError(BoxError.BAD_FIELD, 'password must be a string');
|
||||
if (backupConfig.password.length < 8) return new BoxError(BoxError.BAD_FIELD, 'password must be atleast 8 characters');
|
||||
}
|
||||
|
||||
await storage.api(backupConfig.provider).testConfig(backupConfig);
|
||||
}
|
||||
|
||||
// this skips password check since that policy is only at creation time
|
||||
async function testProviderConfig(backupConfig) {
|
||||
assert.strictEqual(typeof backupConfig, 'object');
|
||||
async function validateEncryptionPassword(password) {
|
||||
assert.strictEqual(typeof password, 'string');
|
||||
|
||||
const func = storage.api(backupConfig.provider);
|
||||
if (!func) return new BoxError(BoxError.BAD_FIELD, 'unknown storage provider');
|
||||
|
||||
await storage.api(backupConfig.provider).testConfig(backupConfig);
|
||||
if (password.length < 8) return new BoxError(BoxError.BAD_FIELD, 'password must be atleast 8 characters');
|
||||
}
|
||||
|
||||
async function remount(auditSource) {
|
||||
|
||||
Reference in New Issue
Block a user