mirror of https://github.com/halo-dev/halo
Fix vulnerability due to uncheck theme id (#499)
parent
23d0a2e01d
commit
f4c2ca2f8d
|
@ -211,8 +211,11 @@ public class FileUtils {
|
||||||
try (Stream<Path> pathStream = Files.list(unzippedPath)) {
|
try (Stream<Path> pathStream = Files.list(unzippedPath)) {
|
||||||
List<Path> childrenPath = pathStream.collect(Collectors.toList());
|
List<Path> childrenPath = pathStream.collect(Collectors.toList());
|
||||||
|
|
||||||
if (childrenPath.size() == 1 && Files.isDirectory(childrenPath.get(0))) {
|
Path realPath = childrenPath.get(0);
|
||||||
return childrenPath.get(0);
|
if (childrenPath.size() == 1 && Files.isDirectory(realPath)) {
|
||||||
|
// Check directory traversal
|
||||||
|
checkDirectoryTraversal(unzippedPath, realPath);
|
||||||
|
return realPath;
|
||||||
}
|
}
|
||||||
return unzippedPath;
|
return unzippedPath;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue