diff --git a/src/backups.js b/src/backups.js index 4d49bc885..28bc072ea 100644 --- a/src/backups.js +++ b/src/backups.js @@ -123,6 +123,11 @@ function testConfig(backupConfig, callback) { // remember to adjust the cron ensureBackup task interval accordingly if (backupConfig.intervalSecs < 6 * 60 * 60) return callback(new BoxError(BoxError.BAD_FIELD, 'Interval must be atleast 6 hours', { field: 'interval' })); + if ('key' in backupConfig) { + if (typeof backupConfig.key !== 'string') return callback(new BoxError(BoxError.BAD_FIELD, 'key must be a string', { field: 'key' })); + if (backupConfig.key.length < 8) return callback(new BoxError(BoxError.BAD_FIELD, 'key must be atleast 8 characters', { field: 'key' })); + } + api(backupConfig.provider).testConfig(backupConfig, callback); } diff --git a/src/test/backups-test.js b/src/test/backups-test.js index 4636e2a8a..982b86d70 100644 --- a/src/test/backups-test.js +++ b/src/test/backups-test.js @@ -78,7 +78,7 @@ describe('backups', function () { database._clear, settings.setBackupConfig.bind(null, { provider: 'filesystem', - key: 'enckey', + key: 'secretenckey', backupFolder: BACKUP_DIR, retentionSecs: 1, format: 'tgz'