Browse Source

Merge pull request #15930 from zzzeebra/fix/tbel-sandbox-formatter-lts-4.2

Fixed arbitrary file write in TBEL script sandbox
pull/16380/head
Viacheslav Klimov 1 month ago
committed by GitHub
parent
commit
9002144337
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 14
      application/src/test/java/org/thingsboard/server/service/script/TbelInvokeServiceTest.java
  2. 2
      pom.xml

14
application/src/test/java/org/thingsboard/server/service/script/TbelInvokeServiceTest.java

@ -288,6 +288,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, "{}");

2
pom.xml

@ -103,7 +103,7 @@
<zookeeper.version>3.9.6</zookeeper.version> <!-- to fix CVE-2026-24281, CVE-2026-24308, CVE-2026-59969 and CVE-2026-84439. TODO: remove override when fixed in curator-client -->
<protobuf.version>3.25.5</protobuf.version> <!-- A Major v4 does not support by the pubsub yet-->
<grpc.version>1.76.0</grpc.version>
<tbel.version>1.2.10</tbel.version>
<tbel.version>1.2.11</tbel.version>
<lombok.version>1.18.46</lombok.version> <!-- must be in sync with spring-boot-dependencies; needed for maven-compiler-plugin annotationProcessorPaths -->
<paho.client.version>1.2.5</paho.client.version>
<paho.mqttv5.client.version>1.2.5</paho.mqttv5.client.version>

Loading…
Cancel
Save