File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
main/scala/org/apache/kyuubi/engine
test/scala/org/apache/kyuubi/engine Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ package org.apache.kyuubi.engine
1919
2020import java .io .File
2121import java .net .{URI , URISyntaxException }
22- import java .nio .file .{Files , Path }
22+ import java .nio .file .{Files , Path , Paths }
2323import java .util .Locale
2424
2525import scala .util .control .NonFatal
@@ -163,7 +163,7 @@ object KyuubiApplicationManager {
163163 s " Relative path ${uri.getPath} is not allowed, please use absolute path. " )
164164 }
165165
166- if (! localDirAllowList.exists(uri.getPath.startsWith(_))) {
166+ if (! localDirAllowList.exists(Paths .get( uri.getPath).normalize .startsWith(_))) {
167167 throw new KyuubiException (
168168 s " The file ${uri.getPath} to access is not in the local dir allow list " +
169169 s " [ ${localDirAllowList.mkString(" ," )}]. " )
Original file line number Diff line number Diff line change @@ -38,6 +38,13 @@ class KyuubiApplicationManagerSuite extends KyuubiFunSuite {
3838 assert(e.getMessage.contains(" is not in the local dir allow list" ))
3939 KyuubiApplicationManager .checkApplicationAccessPath(path, noLocalDirLimitConf)
4040
41+ path = " /apache/kyuubi/../a.jar"
42+ e = intercept[KyuubiException ] {
43+ KyuubiApplicationManager .checkApplicationAccessPath(path, localDirLimitConf)
44+ }
45+ assert(e.getMessage.contains(" is not in the local dir allow list" ))
46+ KyuubiApplicationManager .checkApplicationAccessPath(path, noLocalDirLimitConf)
47+
4148 path = " hdfs:/apache/kyuubijar"
4249 KyuubiApplicationManager .checkApplicationAccessPath(path, localDirLimitConf)
4350 KyuubiApplicationManager .checkApplicationAccessPath(path, noLocalDirLimitConf)
You can’t perform that action at this time.
0 commit comments