diff --git a/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/DefaultTbelInvokeService.java b/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/DefaultTbelInvokeService.java
index e8ce79427d..412a61848e 100644
--- a/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/DefaultTbelInvokeService.java
+++ b/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/DefaultTbelInvokeService.java
@@ -27,8 +27,8 @@ import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.mvel2.ExecutionContext;
import org.mvel2.MVEL;
+import org.mvel2.ParserContext;
import org.mvel2.SandboxedParserConfiguration;
-import org.mvel2.SandboxedParserContext;
import org.mvel2.ScriptMemoryOverflowException;
import org.mvel2.optimizers.OptimizerFactory;
import org.springframework.beans.factory.annotation.Value;
@@ -57,7 +57,6 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
-import java.util.regex.Pattern;
@Slf4j
@ConditionalOnProperty(prefix = "tbel", value = "enabled", havingValue = "true", matchIfMissing = true)
@@ -70,8 +69,6 @@ public class DefaultTbelInvokeService extends AbstractScriptInvokeService implem
private SandboxedParserConfiguration parserConfig;
- private static final Pattern NEW_KEYWORD_PATTERN = Pattern.compile("new\\s");
-
@Getter
@Value("${tbel.max_total_args_size:100000}")
private long maxTotalArgsSize;
@@ -125,7 +122,7 @@ public class DefaultTbelInvokeService extends AbstractScriptInvokeService implem
public void init() {
super.init();
OptimizerFactory.setDefaultOptimizer(OptimizerFactory.SAFE_REFLECTIVE);
- parserConfig = new SandboxedParserConfiguration();
+ parserConfig = ParserContext.enableSandboxedMode();
parserConfig.addImport("JSON", TbJson.class);
parserConfig.registerDataType("Date", TbDate.class, date -> 8L);
parserConfig.registerDataType("Random", Random.class, date -> 8L);
@@ -223,7 +220,7 @@ public class DefaultTbelInvokeService extends AbstractScriptInvokeService implem
}
private Serializable compileScript(String scriptBody) {
- return MVEL.compileExpression(scriptBody, new SandboxedParserContext(parserConfig));
+ return MVEL.compileExpression(scriptBody, new ParserContext());
}
@SuppressWarnings("UnstableApiUsage")
diff --git a/pom.xml b/pom.xml
index 8f3fc1514d..86c27e1a3a 100755
--- a/pom.xml
+++ b/pom.xml
@@ -77,7 +77,7 @@
3.5.5
3.21.9
1.42.1
- 1.0.2
+ 1.0.3
1.18.18
1.2.4
4.1.75.Final