diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/pom.xml b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/pom.xml
index 074c49eab6..737692e5e6 100644
--- a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/pom.xml
+++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/pom.xml
@@ -40,7 +40,6 @@
org.apache.dolphinscheduler
dolphinscheduler-task-api
- provided
diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/AbstractDataSourceProcessor.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/AbstractDataSourceProcessor.java
index fcc744d91a..e2b92c32e2 100644
--- a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/AbstractDataSourceProcessor.java
+++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/AbstractDataSourceProcessor.java
@@ -92,12 +92,15 @@ public abstract class AbstractDataSourceProcessor implements DataSourceProcessor
if (MapUtils.isEmpty(other)) {
return;
}
+
if (!Sets.intersection(other.keySet(), POSSIBLE_MALICIOUS_KEYS).isEmpty()) {
throw new IllegalArgumentException("Other params include possible malicious keys.");
}
- boolean paramsCheck = other.entrySet().stream().allMatch(p -> PARAMS_PATTER.matcher(p.getValue()).matches());
- if (!paramsCheck) {
- throw new IllegalArgumentException("datasource other params illegal");
+
+ for (Map.Entry entry : other.entrySet()) {
+ if (!PARAMS_PATTER.matcher(entry.getKey()).matches()) {
+ throw new IllegalArgumentException("datasource other params: " + entry.getKey() + " illegal");
+ }
}
}
diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-trino/src/test/java/org/apache/dolphinscheduler/plugin/datasource/trino/param/TrinoDataSourceProcessorTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-trino/src/test/java/org/apache/dolphinscheduler/plugin/datasource/trino/param/TrinoDataSourceProcessorTest.java
index 2e6bda5817..d24af09fda 100644
--- a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-trino/src/test/java/org/apache/dolphinscheduler/plugin/datasource/trino/param/TrinoDataSourceProcessorTest.java
+++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-trino/src/test/java/org/apache/dolphinscheduler/plugin/datasource/trino/param/TrinoDataSourceProcessorTest.java
@@ -34,7 +34,7 @@ import org.mockito.junit.jupiter.MockitoExtension;
@ExtendWith(MockitoExtension.class)
public class TrinoDataSourceProcessorTest {
- private TrinoDataSourceProcessor TrinoDatasourceProcessor = new TrinoDataSourceProcessor();
+ private final TrinoDataSourceProcessor TrinoDatasourceProcessor = new TrinoDataSourceProcessor();
@Test
public void testCreateConnectionParams() {
@@ -92,4 +92,17 @@ public class TrinoDataSourceProcessorTest {
Assertions.assertEquals(DataSourceConstants.TRINO_VALIDATION_QUERY,
TrinoDatasourceProcessor.getValidationQuery());
}
+
+ @Test
+ public void testCheckDatasourceParam() {
+ Map others = new HashMap<>();
+ others.put("SSL", "true");
+ others.put("SSLKeyStorePassword", "******");
+ others.put("SSLKeyStorePath", "/home/dolphinscheduler/trino.jks");
+ TrinoDataSourceParamDTO trinoDataSourceParamDTO = new TrinoDataSourceParamDTO();
+ trinoDataSourceParamDTO.setDatabase("dwh");
+ trinoDataSourceParamDTO.setHost("10.11.12.13");
+ trinoDataSourceParamDTO.setOther(others);
+ Assertions.assertDoesNotThrow(() -> TrinoDatasourceProcessor.checkDatasourceParam(trinoDataSourceParamDTO));
+ }
}