Fixed OpenURL feature to only allow https:// or http://

This commit is contained in:
Ylian Saint-Hilaire 2020-10-05 11:40:29 -07:00
parent adc513f08a
commit 7e58ebf54a
3 changed files with 1381 additions and 1372 deletions

View File

@ -2486,7 +2486,7 @@ function createMeshCore(agent) {
// Open a web browser to a specified URL on current user's desktop
function openUserDesktopUrl(url) {
if ((url.toLowerCase().startsWith('http://') == false) || (url.toLowerCase().startsWith('https://') == false)) { return null; }
if ((url.toLowerCase().startsWith('http://') == false) && (url.toLowerCase().startsWith('https://') == false)) { return null; }
var child = null;
try {
switch (process.platform) {

File diff suppressed because it is too large Load Diff

View File

@ -6129,11 +6129,18 @@
var wintype = false, linuxtype = false;
if (currentNode.agent) { if ((currentNode.agent.id > 0) && (currentNode.agent.id < 5)) { wintype = true; } else { linuxtype = true; } }
if ((wintype == true) || (linuxtype == true)) {
var x = "Run commands on this device." + '<br /><br />';
if (wintype == true) { x += '<select id=d2cmdtype style=width:100%><option value=1>' + "Windows Command Prompt" + '</option><option value=2>' + "Windows PowerShell" + '</option></select>'; }
var x = "Run commands on selected devices." + '<br />';
if (wintype == true) {
x += '<select id=d2cmdtype style=width:100%;margin-bottom:4px;margin-top:4px>';
x += '<option value=1>' + "Windows Command Prompt" + '</option><option value=2>' + "Windows PowerShell" + '</option>';
if (linuxtype == true) { x += '<option value=3>' + "Linux/BSD/macOS Command Shell" + '</option>'; }
x += '</select>';
}
x += '<select id=d2cmduser style=width:100%;margin-bottom:4px><option value=0>' + "Run as agent" + '</option><option value=1>' + "Run as user, agent if no user" + '</option><option value=2>' + "Must run as user" + '</option></select>';
x += '<textarea id=d2runcmd style=background-color:#fcf3cf;width:100%;height:200px;resize:none;overflow-y:scroll></textarea>';
setDialogMode(2, "Run Commands", 3, deviceRunCmdsFunctionEx, x);
Q('d2runcmd').focus();
//QE('idx_dlgOkButton', true);
}
} else {
// Power operation
@ -6142,9 +6149,9 @@
}
function deviceRunCmdsFunctionEx() {
var cmdType = 3;
if ((currentNode.agent.id > 0) && (currentNode.agent.id < 5)) { cmdType = Q('d2cmdtype').value; }
meshserver.send({ action: 'runcommands', nodeids: [ currentNode._id ], type: parseInt(cmdType), cmds: Q('d2runcmd').value });
var type = 3;
try { type = parseInt(Q('d2cmdtype').value); } catch (ex) { }
meshserver.send({ action: 'runcommands', nodeids: [ currentNode._id ], type: type, cmds: Q('d2runcmd').value, runAsUser: parseInt(Q('d2cmduser').value) });
}
// Called when MeshCommander needs new credentials or updated credentials.