Skip to content

Commit

Permalink
[JENKINS-32778] - Prevent extracting archived plugins outside of targ…
Browse files Browse the repository at this point in the history
…et path (#3402)
  • Loading branch information
aviadatsnyk authored and oleg-nenashev committed May 5, 2018
1 parent 4278461 commit 8ede533
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/src/main/java/hudson/FilePath.java
Expand Up @@ -598,6 +598,10 @@ private void unzip(File dir, File zipFile) throws IOException {
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 {
Expand Down

0 comments on commit 8ede533

Please sign in to comment.