From 13e20e47bf265e838c267154dc731ba962e4a9fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 13 Jul 2023 01:52:06 +0200 Subject: [PATCH] jsParse: Replace eval() The evil() function is considered eval, replace it like we already did in looking glass. Part-of: --- js/misc/jsParse.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/misc/jsParse.js b/js/misc/jsParse.js index 97a6ce470..18ce70398 100644 --- a/js/misc/jsParse.js +++ b/js/misc/jsParse.js @@ -197,7 +197,9 @@ function getPropertyNamesFromExpression(expr, commandHeader = '') { let obj = {}; if (!isUnsafeExpression(expr)) { try { - obj = eval(commandHeader + expr); + const lines = expr.split(';'); + lines.push(`return ${lines.pop()}`); + obj = Function(commandHeader + lines.join(';'))(); } catch (e) { return []; }