You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by arina-ielchiieva <gi...@git.apache.org> on 2017/11/23 11:21:02 UTC

[GitHub] drill pull request #1050: DRILL-5964: Do not allow queries to access paths o...

Github user arina-ielchiieva commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1050#discussion_r152773919
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSelection.java ---
    @@ -252,11 +252,15 @@ private static String buildPath(final String[] path, final int folderIndex) {
         return builder.toString();
       }
     
    -  public static FileSelection create(final DrillFileSystem fs, final String parent, final String path) throws IOException {
    +  public static FileSelection create(final DrillFileSystem fs, final String parent, final String path,
    +      final boolean allowAccessOutsideWorkspace) throws IOException {
         Stopwatch timer = Stopwatch.createStarted();
         boolean hasWildcard = path.contains(WILD_CARD);
     
         final Path combined = new Path(parent, removeLeadingSlash(path));
    +    if (!allowAccessOutsideWorkspace) {
    +      checkBackPaths(parent, combined.toString(), path);
    --- End diff --
    
    I usually void using `toString` for `Path`, consider using `combined.toUri().getPath()`.


---