abstractdog commented on code in PR #439:
URL: https://github.com/apache/tez/pull/439#discussion_r2480578123


##########
tez-common/src/main/java/org/apache/tez/common/web/ProfileOutputServlet.java:
##########
@@ -43,7 +44,15 @@ public void doGet(HttpServletRequest request, 
HttpServletResponse response) thro
       writeMessage(response, "Run the profiler to be able to receive its 
output");
       return;
     }
-    File outputFile = new File(ProfileServlet.OUTPUT_DIR, queriedFile);
+    Path outputDir = 
Paths.get(ProfileServlet.OUTPUT_DIR).toAbsolutePath().normalize();
+    Path requestedPath = outputDir.resolve(queriedFile).normalize();
+
+    if (!requestedPath.startsWith(outputDir)) {

Review Comment:
   what about an additional status here:
   ```
       response.setStatus(HttpServletResponse.SC_FORBIDDEN);
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to