From 9f06464c803ff941d8788eb5ec1b6e717273a312 Mon Sep 17 00:00:00 2001 From: Oleksandra Matviienko Date: Mon, 13 Jul 2026 23:19:16 +0200 Subject: [PATCH] Update tbel to 1.2.11 and add java.util.Formatter sandbox test --- .../service/script/TbelInvokeServiceTest.java | 14 ++++++++++++++ pom.xml | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/application/src/test/java/org/thingsboard/server/service/script/TbelInvokeServiceTest.java b/application/src/test/java/org/thingsboard/server/service/script/TbelInvokeServiceTest.java index 8618e515c8..7a8d3f68a6 100644 --- a/application/src/test/java/org/thingsboard/server/service/script/TbelInvokeServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/script/TbelInvokeServiceTest.java @@ -301,6 +301,20 @@ class TbelInvokeServiceTest extends AbstractTbelInvokeTest { }); } + @Test + void givenForbiddenFormatter_whenInvoking_thenThrowsRuntimeError() throws ExecutionException, InterruptedException { + UUID scriptId = evalScript("new java.util.Formatter(\"/tmp/test.txt\")"); + assertThatThrownBy(() -> invokeScript(scriptId, "{\"temperature\":25}")) + .isInstanceOf(ExecutionException.class) + .cause() + .isInstanceOf(TbScriptException.class) + .asInstanceOf(type(TbScriptException.class)) + .satisfies(ex -> { + assertThat(ex.getErrorCode()).isEqualTo(TbScriptException.ErrorCode.RUNTIME); + assertThat(ex.getCause().getMessage()).contains("could not resolve class: java.util.Formatter"); + }); + } + private void assertThatScriptIsBlocked(UUID scriptId) { assertThatThrownBy(() -> { invokeScriptResultString(scriptId, "{}"); diff --git a/pom.xml b/pom.xml index 7d42f9f1c7..87280de7e1 100755 --- a/pom.xml +++ b/pom.xml @@ -94,7 +94,7 @@ 3.9.5 3.25.5 1.76.0 - 1.2.10 + 1.2.11 1.18.46 1.2.5 1.2.5