You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/03/15 03:27:14 UTC

[GitHub] [dolphinscheduler] zhuangchong commented on a change in pull request #8883: blank path should not be read

zhuangchong commented on a change in pull request #8883:
URL: https://github.com/apache/dolphinscheduler/pull/8883#discussion_r826549300



##########
File path: dolphinscheduler-log-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java
##########
@@ -146,10 +147,13 @@ public void process(Channel channel, Command command) {
      */
     private boolean checkPathSecurity(String path) {
         String dsHome = System.getProperty("DOLPHINSCHEDULER_WORKER_HOME");
-        if (path.startsWith(dsHome) && !path.contains("../") && path.endsWith(".log")) {
-            return true;
+        if (!StringUtils.isBlank(path)) {
+            if (path.startsWith(dsHome) && !path.contains("../") && path.endsWith(".log")) {
+                return true;
+            }

Review comment:
       I think it might be better to write it this way.
   ```Java
   return path.startsWith(dsHome) && !path.contains("../") && path.endsWith(".log");
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org