Merge pull request #3425 from aviadatsnyk/patch-1

[JENKINS-56931] handle absolute paths correctly when unzipping
This commit is contained in:
Baptiste Mathus authored and GitHub committed 2019-04-08 21:51:12 +02:00
commit 58dfce4b1c
6 files changed
+162 -1

No files matched your search

+1 -1
View File
@@ -643,7 +643,7 @@ public final class FilePath implements Serializable {
while (entries.hasMoreElements()) {
ZipEntry e = entries.nextElement();
File f = new File(dir, e.getName());
if (!f.toPath().normalize().startsWith(dir.toPath())) {
if (!f.getCanonicalPath().startsWith(dir.getCanonicalPath())) {
throw new IOException(
"Zip " + zipFile.getPath() + " contains illegal file name that breaks out of the target directory: " + e.getName());
}