mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-09 10:06:13 +00:00
[JENKINS-32778] - Prevent extracting archived plugins outside of target path (#3402)
This commit is contained in:
1 parent
4278461c90
commit
8ede53387e
1 file changed
+4
@@ -598,6 +598,10 @@ 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())) {
|
||||
throw new IOException(
|
||||
"Zip " + zipFile.getPath() + " contains illegal file name that breaks out of the target directory: " + e.getName());
|
||||
}
|
||||
if (e.isDirectory()) {
|
||||
mkdirs(f);
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user