Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.

Commit 728ff3e

Browse files
committed
CureKit-GHSA-fvf5-grm7-538p adding trailing separator to base dir if not present in methon isFileOutsideDir
1 parent d6ac3c3 commit 728ff3e

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

.idea/libraries/Maven__org_owasp_encoder_encoder_1_2_3.xml

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/main/java/io/whitesource/cure/FileSecurityUtils.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@ public static boolean isFileOutsideDir(
2222
@NonNull final String filePath, @NonNull final String baseDirPath) throws IOException {
2323
File file = new File(filePath);
2424
File baseDir = new File(baseDirPath);
25-
return !file.getCanonicalPath().startsWith(baseDir.getCanonicalPath());
25+
return !file.getCanonicalPath().startsWith(addTrailingSeparator(baseDir.getCanonicalPath()));
26+
}
27+
28+
private static String addTrailingSeparator(String path) {
29+
if (!path.endsWith(File.separator)) {
30+
return path + File.separator;
31+
}
32+
return path;
2633
}
2734

2835
/**

0 commit comments

Comments
 (0)