mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-10-31 13:35:19 +00:00
[JENKINS-51777] Don't let tar entries escape target dir
(cherry picked from commit 7438abb88f)
This commit is contained in:
1 parent
4cb86a5c30
commit
f42fe0fc63
1 file changed
+4
@@ -2447,6 +2447,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