Added check that backup path is not in meshcentral-data folder, #3266
Ylian Saint-Hilaire committed
Nov 9, 2021 at 00:03 UTC
3a42b843152109579ae5eaa64e5fc4be1339a49c
2 files changed
+8
-1
meshcentral.js
+6
@@ -1747,6 +1747,12 @@ function CreateMeshCentralServer(config, args) {
1747
if (obj.config.settings.autobackup == null) { obj.config.settings.autobackup = { backupintervalhours: 24, keeplastdaysbackup: 10 }; }
1748
else if (obj.config.settings.autobackup === false) { delete obj.config.settings.autobackup; }
1749
1750
+ // Check that autobackup path is not within the "meshcentral-data" folder.
1751
+ if ((typeof obj.config.settings.autobackup.backuppath == 'string') && (obj.path.normalize(obj.config.settings.autobackup.backuppath).startsWith(obj.path.normalize(obj.datapath)))) {
1752
+ addServerWarning("Backup path can't be set within meshcentral-data folder, backup settings ignored.", 21);
1753
+ delete obj.config.settings.autobackup;
1754
+ }
1755
+
1756
// Load Intel AMT passwords from the "amtactivation.log" file
1757
obj.loadAmtActivationLogPasswords(function (amtPasswords) {
1758
obj.amtPasswords = amtPasswords;
views/default.handlebars
+2
-1
@@ -2219,7 +2219,8 @@
2219
17: "SendGrid server has limited use in LAN mode.",
2220
18: "SMTP server has limited use in LAN mode.",
2221
19: "SMS gateway has limited use in LAN mode.",
2222
- 20: "Invalid \"LoginCookieEncryptionKey\" in config.json."
2222
+ 20: "Invalid \"LoginCookieEncryptionKey\" in config.json.",
2223
+ 21: "Backup path can't be set within meshcentral-data folder, backup settings ignored."
2224
};
2225
var x = '';
2226
for (var i in message.warnings) {