From d38a0d1021cf82af4341334f8470dad8d3e3fee4 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Mon, 23 Mar 2020 13:34:28 -0700 Subject: [PATCH] Input validation fix --- meshcentral.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meshcentral.js b/meshcentral.js index 81620ff0..7a7044b5 100644 --- a/meshcentral.js +++ b/meshcentral.js @@ -617,7 +617,8 @@ function CreateMeshCentralServer(config, args) { }); return; } - if (obj.args.adminaccount || (obj.args.resetaccount.startsWith('user/') == false)) { + if (obj.args.adminaccount) { + if (obj.args.resetaccount.startsWith('user/') == false) { console.log('Invalid userid, usage: --adminaccount [userid].'); process.exit(); return; } obj.db.Get(obj.args.adminaccount, function (err, docs) { if ((err != null) || (docs == null) || (docs.length == 0)) { console.log('Unknown userid, usage: --adminaccount [userid].'); process.exit(); return; } docs[0].siteadmin = 0xFFFFFFFF; // Set user as site administrator