Skip to content

Commit fe4e5df

Browse files
committed
chore(QTDI-1086) Improve path manipulation detection
1 parent ca2e04d commit fe4e5df

File tree

2 files changed

+2
-2
lines changed
  • component-tools/src/main/java/org/talend/sdk/component/tools/exec
  • talend-component-kit-intellij-plugin/src/main/java/org/talend/sdk/component/intellij/module

2 files changed

+2
-2
lines changed

component-tools/src/main/java/org/talend/sdk/component/tools/exec/CarMain.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ private static Properties installJars(final File m2Root, final boolean forceOver
310310
if (entry.getName().startsWith("MAVEN-INF/repository/")) {
311311
final String path = entry.getName().substring("MAVEN-INF/repository/".length());
312312
final File output = new File(m2Root, path);
313-
if (!output.getCanonicalPath().startsWith(m2Root.getCanonicalPath())) {
313+
if (!output.getCanonicalPath().startsWith(m2Root.getCanonicalPath() + File.separator)) {
314314
throw new IOException("The output file is not contained in the destination directory");
315315
}
316316
if (!output.exists() || forceOverwrite) {

talend-component-kit-intellij-plugin/src/main/java/org/talend/sdk/component/intellij/module/ProjectDownloader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ private static void unzip(final InputStream read, final File destination, final
117117
path = path.replaceFirst("^[^/]+/", "");
118118
}
119119
final File file = new File(destination, path);
120-
if (!file.getCanonicalPath().startsWith(destination.getCanonicalPath())) {
120+
if (!file.getCanonicalPath().startsWith(destination.getCanonicalPath() + File.separator)) {
121121
throw new IOException("The output file is not contained in the destination directory");
122122
}
123123

0 commit comments

Comments
 (0)