You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "cstamas (via GitHub)" <gi...@apache.org> on 2026/07/13 16:34:24 UTC

[PR] Validate path components [maven-resolver]

cstamas opened a new pull request, #1959:
URL: https://github.com/apache/maven-resolver/pull/1959

   But make it reusable as well.
   
   Supersedes #1958
   


-- 
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: issues-unsubscribe@maven.apache.org

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


Re: [PR] Validate path components [maven-resolver]

Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas merged PR #1959:
URL: https://github.com/apache/maven-resolver/pull/1959


-- 
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: issues-unsubscribe@maven.apache.org

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


Re: [PR] Validate path components [maven-resolver]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #1959:
URL: https://github.com/apache/maven-resolver/pull/1959#issuecomment-4973473268

   @cstamas Please assign appropriate label to PR according to the type of change.


-- 
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: issues-unsubscribe@maven.apache.org

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


Re: [PR] Validate path components [maven-resolver]

Posted by "atokle (via GitHub)" <gi...@apache.org>.
atokle commented on code in PR #1959:
URL: https://github.com/apache/maven-resolver/pull/1959#discussion_r3585554436


##########
maven-resolver-util/src/main/java/org/eclipse/aether/util/PathUtils.java:
##########
@@ -72,4 +75,50 @@ public static String stringToPathSegment(String string) {
         }
         return result.toString();
     }
+
+    /**
+     * Validates that a coordinate component does not contain path traversal sequences
+     * or path separator characters that could cause the composed path to escape
+     * the local repository directory.
+     *
+     * @since 2.0.21
+     */
+    public static void validatePathComponent(String value, String label) {
+        if (value != null && !value.isEmpty()) {
+            // Important: "equals .." and not "contains ..", as if escape attempted, it will contain path separators
+            // OTOH: version "1.." is valid version string!
+            if (value.equals("..") || value.contains("/") || value.contains("\\")) {
+                throw new IllegalArgumentException(
+                        "Invalid " + label + ": must not contain '..', '/' or '\\': " + value);

Review Comment:
   Should maybe be:
   "Invalid " + label + ": must not be equal to '..' or contain '/' or '\\': " + value);



-- 
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: issues-unsubscribe@maven.apache.org

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


Re: [PR] Validate path components [maven-resolver]

Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on PR #1959:
URL: https://github.com/apache/maven-resolver/pull/1959#issuecomment-4960663745

   Agreed with assesment: will remove `validatePathComponent` from `GenericVersion` ctor


-- 
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: issues-unsubscribe@maven.apache.org

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


Re: [PR] Validate path components [maven-resolver]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #1959:
URL: https://github.com/apache/maven-resolver/pull/1959#issuecomment-4960996902

   Thanks for the quick update, @cstamas! Removing the `validatePathComponent` from the `GenericVersion` constructor looks right — this keeps the validation at the path-composition layer where it belongs, without affecting version parsing semantics. The remaining changes (PathUtils extraction + DefaultLocalPathComposer validation) look good.


-- 
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: issues-unsubscribe@maven.apache.org

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