cstamas commented on code in PR #2079:
URL: https://github.com/apache/maven-resolver/pull/2079#discussion_r3892601742


##########
maven-resolver-transport-file/src/main/java/org/eclipse/aether/transport/file/FileTransporter.java:
##########
@@ -163,10 +163,22 @@ protected void implPut(PutTask task) throws Exception {
 
     private Path getPath(TransportTask task, boolean required) throws 
Exception {
         String path = task.getLocation().getPath();
-        if (path.contains("../")) {
+        if (path == null) {
+            throw new IllegalArgumentException("illegal resource path: null");
+        }
+        Path relative = fileSystem.getPath(path);
+        if (relative.isAbsolute()) {
+            throw new IllegalArgumentException("illegal resource path: " + 
path);
+        }
+        for (Path segment : relative) {
+            if ("..".equals(segment.toString())) {
+                throw new IllegalArgumentException("illegal resource path: " + 
path);
+            }
+        }
+        Path file = basePath.resolve(relative).normalize();
+        if (!file.startsWith(basePath.normalize())) {

Review Comment:
   This is overly aggressive (to normalize unchanging `basepath` for each 
file). IMHO it is already normalized in ctor, should be just used, no?



-- 
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