Skip to content

Commit

Permalink
[hotfix] [SECURITY] Fix Zip Slip Vulnerability
Browse files Browse the repository at this point in the history
This closes #387
  • Loading branch information
JLLeitschuh authored Nov 18, 2022
1 parent c2df467 commit ac043ed
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public static void unzip(String zipFileName, String targetDirectory) throws IOEx
ZipEntry entry;
while ((entry = zip.getNextEntry()) != null) {
File file = new File(targetDirectory, entry.getName());
if (!file.toPath().normalize().startsWith(targetDirectory)) {
throw new IOException("Bad zip entry");
}

if (entry.isDirectory()) {
file.mkdirs();
Expand Down

0 comments on commit ac043ed

Please sign in to comment.