Where can I change MIN_INFLATE_RATIO to accept ZIP BOMBs? - Mendix Forum

Where can I change MIN_INFLATE_RATIO to accept ZIP BOMBs?

1

I’m getting logs of users not being able to upload an excel file due to their compression ratio being below the ZipInflateRatio, which results in an exception. Apparantly this ratio can be configured, but I’m not able to spot where I can do this. So.. Where can I? 

The error that’s provided:

com.mendix.core.CoreException: Document could not be imported, because: Zip bomb detected! The file would exceed the max. ratio of compressed file size to the size of the expanded data.
This may indicate that the file is used to inflate memory usage and thus could pose a security risk.
You can adjust this limit via ZipSecureFile.setMinInflateRatio() if you need to work with files which exceed this limit.
Uncompressed size: 104023, Raw/compressed size: 1024, ratio: 0.009844
Limits: MIN_INFLATE_RATIO: 0.010000, Entry: xl/sharedStrings.xml
    at excelimporter.reader.ExcelImporter.startImport(ExcelImporter.java:129)

asked
1 answers
1

You can try adding the following line below to the excelimporter javasource file.

// javasource/excelimporter/reader/readers/ExcelReader.javaLine 73
public ExcelReader(IContext context, IMendixObject template) throws CoreException {
   ....
   // Set zipbomb detection ration
   ZipSecureFile.setMinInflateRatio(0);
}
answered