]> source.dussan.org Git - jgit.git/commitdiff
SubmoduleAddCommand: Remove double-check of submodule name 77/130577/2
authorJonathan Nieder <jrn@google.com>
Sun, 7 Oct 2018 21:59:35 +0000 (21:59 +0000)
committerJonathan Nieder <jrn@google.com>
Mon, 8 Oct 2018 02:14:02 +0000 (22:14 -0400)
Since v4.7.5.201810051826-r~3 (SubmoduleAddCommand: Reject submodule
URIs that look like cli options, 2018-09-24), SubmoduleAddCommand
checks submodule names for ".." path components in
assertValidSubmoduleName.  This additional check for the same is
redundant.

Change-Id: I993326a370978880b690dc133a81fa3025935bcb
Signed-off-by: Jonathan Nieder <jrn@gmail.com>
org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java

index 244a15686fc0cc0947f2231709c48f93f801d1ed..f92455a96a17ed88a5b06f8d180a405f6331b2c9 100644 (file)
@@ -179,21 +179,6 @@ public class SubmoduleAddCommand extends
                        // Use the path as the default.
                        name = path;
                }
-               if (name.contains("/../") || name.contains("\\..\\") //$NON-NLS-1$ //$NON-NLS-2$
-                               || name.startsWith("../") || name.startsWith("..\\") //$NON-NLS-1$ //$NON-NLS-2$
-                               || name.endsWith("/..") || name.endsWith("\\..")) { //$NON-NLS-1$ //$NON-NLS-2$
-                       // Submodule names are used to store the submodule repositories
-                       // under $GIT_DIR/modules. Having ".." in submodule names makes a
-                       // vulnerability (CVE-2018-11235
-                       // https://bugs.eclipse.org/bugs/show_bug.cgi?id=535027#c0)
-                       // Reject the names with them. The callers need to make sure the
-                       // names free from these. We don't automatically replace these
-                       // characters or canonicalize by regarding the name as a file path.
-                       // Since Path class is platform dependent, we manually check '/' and
-                       // '\\' patterns here.
-                       throw new IllegalArgumentException(MessageFormat
-                                       .format(JGitText.get().invalidNameContainsDotDot, name));
-               }
 
                try {
                        SubmoduleValidator.assertValidSubmoduleName(name);