Skip to content

Commit

Permalink
合并拉取请求 #526
Browse files Browse the repository at this point in the history
fix: 修复目录穿越问题
  • Loading branch information
zhaojun1998 committed May 27, 2023
2 parents 0344f68 + 6aefc10 commit 72a627b
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ private FileItemResult fileToFileItem(File file, String folderPath) {
private static void checkPathSecurity(String... paths) {
for (String path : paths) {
// 路径中不能包含 .. 不然可能会获取到上层文件夹的内容
if (StrUtil.containsAny(path, "../", "..\\")) {
if (StrUtil.startWith(path, "/..") || StrUtil.containsAny(path, "../", "..\\")) {
throw new IllegalArgumentException("文件路径存在安全隐患: " + path);
}
}
Expand Down

0 comments on commit 72a627b

Please sign in to comment.