- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.poi.openxml4j.util.ZipSecureFile.setMinInflateRatio()
方法的一些代码示例,展示了ZipSecureFile.setMinInflateRatio()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipSecureFile.setMinInflateRatio()
方法的具体详情如下:
包路径:org.apache.poi.openxml4j.util.ZipSecureFile
类名称:ZipSecureFile
方法名:setMinInflateRatio
[英]Sets the ratio between de- and inflated bytes to detect zipbomb. It defaults to 1% (= 0.01d), i.e. when the compression is better than 1% for any given read package part, the parsing will fail indicating a Zip-Bomb.
[中]设置反压缩字节和膨胀字节之间的比率,以检测压缩字节。它默认为1%(=0.01d),也就是说,当任何给定的读取包部分的压缩比大于1%时,解析将失败,表明存在压缩炸弹。
代码示例来源:origin: wuyouzhuguli/FEBS-Shiro
static void writeByLocalOrBrowser(HttpServletResponse response, String fileName, SXSSFWorkbook wb, OutputStream out) {
try {
ZipSecureFile.setMinInflateRatio(0L);
if (response != null) {
// response对象不为空,响应到浏览器下载
response.setContentType(FebsConstant.XLSX_CONTENT_TYPE);
response.setHeader("Content-disposition", "attachment; filename="
+ URLEncoder.encode(String.format("%s%s", fileName, FebsConstant.XLSX_SUFFIX), "UTF-8"));
if (out == null) {
out = response.getOutputStream();
}
}
wb.write(out);
out.flush();
out.close();
} catch (Exception e) {
log.error(e.getMessage());
}
}
代码示例来源:origin: pentaho/pentaho-kettle
minInflateRatio = Const.KETTLE_ZIP_MIN_INFLATE_RATIO_DEFAULT;
ZipSecureFile.setMinInflateRatio( minInflateRatio );
代码示例来源:origin: pentaho/pentaho-kettle
@Test
public void testZipBombConfiguration_Default() throws Exception {
// First set some random values
Long bogusMaxEntrySize = 1000L;
ZipSecureFile.setMaxEntrySize( bogusMaxEntrySize );
Long bogusMaxTextSize = 1000L;
ZipSecureFile.setMaxTextSize( bogusMaxTextSize );
Double bogusMinInflateRatio = 0.5d;
ZipSecureFile.setMinInflateRatio( bogusMinInflateRatio );
// Verify that the bogus values were set
assertEquals( bogusMaxEntrySize, (Long) ZipSecureFile.getMaxEntrySize() );
assertEquals( bogusMaxTextSize, (Long) ZipSecureFile.getMaxTextSize() );
assertEquals( bogusMinInflateRatio, (Double) ZipSecureFile.getMinInflateRatio() );
// Initializing the ExcelInput step should make the new values to be set
meta.setSpreadSheetType( SpreadSheetType.SAX_POI );
init( "Balance_Type_Codes.xlsx" );
// Verify that the default values were used
assertEquals( Const.KETTLE_ZIP_MAX_ENTRY_SIZE_DEFAULT, (Long) ZipSecureFile.getMaxEntrySize() );
assertEquals( Const.KETTLE_ZIP_MAX_TEXT_SIZE_DEFAULT, (Long) ZipSecureFile.getMaxTextSize() );
assertEquals( Const.KETTLE_ZIP_MIN_INFLATE_RATIO_DEFAULT, (Double) ZipSecureFile.getMinInflateRatio() );
}
代码示例来源:origin: openl-tablets/openl-tablets
public static void configureZipBombDetection() {
// ZIP bomb detection tuning. Don't disable it by setting it in 0.
// https://bz.apache.org/bugzilla/show_bug.cgi?id=58499
// 0.001 is when 1MByte expands to 1 GByte
ZipSecureFile.setMinInflateRatio(0.001);
}
代码示例来源:origin: wuyouzhuguli/FEBS-Security
static void writeByLocalOrBrowser(HttpServletResponse response, String fileName, SXSSFWorkbook wb, OutputStream out) {
try {
ZipSecureFile.setMinInflateRatio(0L);
if (response != null) {
// response对象不为空,响应到浏览器下载
response.setContentType(FebsConstant.XLSX_CONTENT_TYPE);
response.setHeader("Content-disposition", "attachment; filename="
+ URLEncoder.encode(String.format("%s%s", fileName, FebsConstant.XLSX_SUFFIX), "UTF-8"));
if (out == null) {
out = response.getOutputStream();
}
}
wb.write(out);
out.flush();
out.close();
} catch (Exception e) {
log.error(e.getMessage());
}
}
我正在使用这个函数调用,因为当我读取一个受信任的文件时,它会导致 zipbomb 错误。 ZipSecureFile.setMinInflateRatio(双比率) FileInputStrea
本文整理了Java中org.apache.poi.openxml4j.util.ZipSecureFile.setMinInflateRatio()方法的一些代码示例,展示了ZipSecureFile
我是一名优秀的程序员,十分优秀!