mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-10-26 19:15:09 +00:00
Merge pull request #5613 from trungPa/JENKINS-66094
[JENKINS-66094]Use Path.startsWith() for subdirectory check when unzipping
This commit is contained in:
4 files changed
+60
-1
No files matched your search
@@ -696,7 +696,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
while (entries.hasMoreElements()) {
|
||||
ZipEntry e = entries.nextElement();
|
||||
File f = new File(dir, e.getName());
|
||||
if (!f.getCanonicalPath().startsWith(dir.getCanonicalPath())) {
|
||||
if (!f.getCanonicalFile().toPath().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