You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by pe...@apache.org on 2023/03/22 11:50:37 UTC
[linkis] branch dev-1.3.2 updated: fix some bugs (#4400)
This is an automated email from the ASF dual-hosted git repository.
peacewong pushed a commit to branch dev-1.3.2
in repository https://gitbox.apache.org/repos/asf/linkis.git
The following commit(s) were added to refs/heads/dev-1.3.2 by this push:
new b77cb5742 fix some bugs (#4400)
b77cb5742 is described below
commit b77cb5742199bb9234cf7e545210f0392518d854
Author: aiceflower <ki...@gmail.com>
AuthorDate: Wed Mar 22 19:50:31 2023 +0800
fix some bugs (#4400)
* udf path check
---
.../apache/linkis/httpclient/config/ClientConfigBuilder.scala | 9 ++++++++-
.../org/apache/linkis/filesystem/restful/api/FsRestfulApi.java | 5 ++++-
.../java/org/apache/linkis/udf/service/impl/UDFServiceImpl.java | 9 ++++++++-
3 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/config/ClientConfigBuilder.scala b/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/config/ClientConfigBuilder.scala
index c3e5afba3..26170a457 100644
--- a/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/config/ClientConfigBuilder.scala
+++ b/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/config/ClientConfigBuilder.scala
@@ -19,6 +19,7 @@ package org.apache.linkis.httpclient.config
import org.apache.linkis.common.utils.{DefaultRetryHandler, RetryHandler}
import org.apache.linkis.httpclient.authentication.AuthenticationStrategy
+import org.apache.linkis.httpclient.exception.HttpClientRetryException
import org.apache.linkis.httpclient.loadbalancer.LoadBalancerStrategy
import scala.concurrent.duration.TimeUnit
@@ -38,7 +39,13 @@ class ClientConfigBuilder protected () {
protected var readTimeout: Long = _
protected var maxConnection: Int = _
protected var retryEnabled: Boolean = true
- protected var retryHandler: RetryHandler = new DefaultRetryHandler
+ protected var retryHandler: RetryHandler = buildDefaultRetryHandler()
+
+ def buildDefaultRetryHandler(): RetryHandler = {
+ retryHandler = new DefaultRetryHandler
+ retryHandler.addRetryException(classOf[HttpClientRetryException])
+ retryHandler
+ }
def addServerUrl(serverUrl: String): this.type = {
this.serverUrl = serverUrl
diff --git a/linkis-public-enhancements/linkis-script-dev/linkis-storage-script-dev-server/src/main/java/org/apache/linkis/filesystem/restful/api/FsRestfulApi.java b/linkis-public-enhancements/linkis-script-dev/linkis-storage-script-dev-server/src/main/java/org/apache/linkis/filesystem/restful/api/FsRestfulApi.java
index 9adfbbd2d..1e41baa23 100644
--- a/linkis-public-enhancements/linkis-script-dev/linkis-storage-script-dev-server/src/main/java/org/apache/linkis/filesystem/restful/api/FsRestfulApi.java
+++ b/linkis-public-enhancements/linkis-script-dev/linkis-storage-script-dev-server/src/main/java/org/apache/linkis/filesystem/restful/api/FsRestfulApi.java
@@ -95,12 +95,15 @@ public class FsRestfulApi {
LOGGER.debug("not check filesystem owner.");
return true;
}
+ if (requestPath.contains(WorkspaceUtil.suffixTuning(HDFS_USER_ROOT_PATH_PREFIX.getValue()))
+ || Configuration.isAdmin(userName)) {
+ return true;
+ }
requestPath = requestPath.toLowerCase().trim() + "/";
String hdfsUserRootPathPrefix =
WorkspaceUtil.suffixTuning(HDFS_USER_ROOT_PATH_PREFIX.getValue());
String hdfsUserRootPathSuffix = HDFS_USER_ROOT_PATH_SUFFIX.getValue();
String localUserRootPath = WorkspaceUtil.suffixTuning(LOCAL_USER_ROOT_PATH.getValue());
- String path;
String workspacePath = hdfsUserRootPathPrefix + userName + hdfsUserRootPathSuffix;
String enginconnPath = localUserRootPath + userName;
diff --git a/linkis-public-enhancements/linkis-udf/linkis-udf-service/src/main/java/org/apache/linkis/udf/service/impl/UDFServiceImpl.java b/linkis-public-enhancements/linkis-udf/linkis-udf-service/src/main/java/org/apache/linkis/udf/service/impl/UDFServiceImpl.java
index 7ca1cc611..14ab927e8 100644
--- a/linkis-public-enhancements/linkis-udf/linkis-udf-service/src/main/java/org/apache/linkis/udf/service/impl/UDFServiceImpl.java
+++ b/linkis-public-enhancements/linkis-udf/linkis-udf-service/src/main/java/org/apache/linkis/udf/service/impl/UDFServiceImpl.java
@@ -125,7 +125,14 @@ public class UDFServiceImpl implements UDFService {
throw new UDFException("分类名不能为空!");
}
// 支持hdfs path
- FsPath fsPath = new FsPath(udfVo.getPath());
+ String path = udfVo.getPath();
+ if (StringUtils.isBlank(path) || path.contains("../")) {
+ throw new UDFException(
+ "The path: "
+ + path
+ + " of udf is error. Please rename it and rebuild it.(udf的路径错误,请修改后重建)");
+ }
+ FsPath fsPath = new FsPath(path);
// FileSystem fileSystem = (FileSystem) FSFactory.getFs(fsPath.getFsType());
FileSystem fileSystem = (FileSystem) FSFactory.getFsByProxyUser(fsPath, userName);
if (udfVo.getUdfType() == UDF_JAR && StringUtils.isNotBlank(udfVo.getPath())) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org