mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-06 08:36:01 +00:00
[JENKINS-51777] Don't let tar entries escape target dir
This commit is contained in:
1 parent
e992e1153b
commit
7438abb88f
1 file changed
+4
@@ -2452,6 +2452,10 @@ public final class FilePath implements Serializable {
|
||||
TarArchiveEntry te;
|
||||
while ((te = t.getNextTarEntry()) != null) {
|
||||
File f = new File(baseDir, te.getName());
|
||||
if (!f.toPath().normalize().startsWith(baseDir.toPath())) {
|
||||
throw new IOException(
|
||||
"Tar " + name + " contains illegal file name that breaks out of the target directory: " + te.getName());
|
||||
}
|
||||
if (te.isDirectory()) {
|
||||
mkdirs(f);
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user