Introduced protections against "zip slip" attacks

This commit is contained in:
pixeebot[bot] 2025-07-10 15:32:14 +00:00 committed by GitHub
parent 624e04a783
commit d7d44ea06b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,6 @@
package stirling.software.common.service; package stirling.software.common.service;
import io.github.pixee.security.ZipSecurity;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
@ -360,7 +361,7 @@ public class TaskManager {
MultipartFile zipFile = fileStorage.retrieveFile(zipFileId); MultipartFile zipFile = fileStorage.retrieveFile(zipFileId);
try (ZipInputStream zipIn = try (ZipInputStream zipIn =
new ZipInputStream(new ByteArrayInputStream(zipFile.getBytes()))) { ZipSecurity.createHardenedInputStream(new ByteArrayInputStream(zipFile.getBytes()))) {
ZipEntry entry; ZipEntry entry;
while ((entry = zipIn.getNextEntry()) != null) { while ((entry = zipIn.getNextEntry()) != null) {
if (!entry.isDirectory()) { if (!entry.isDirectory()) {