mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-10-28 20:15:22 +00:00
Merge pull request #3425 from aviadatsnyk/patch-1
[JENKINS-56931] handle absolute paths correctly when unzipping
This commit is contained in:
6 files changed
+162
-1
No files matched your search
@@ -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());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user