修改sql注入
This commit is contained in:
+21
-1
@@ -4635,11 +4635,31 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
bis.close(); // 先开后关
|
||||
}
|
||||
|
||||
private void checkForSQLInjection(Map<String, Object> parameterMap) {
|
||||
// 定义要检查的特殊字符
|
||||
String[] specialCharacters = {"'", "\"", "\\", "<", ">", "&", "*", ";"};
|
||||
|
||||
for (Map.Entry<String, Object> entry : parameterMap.entrySet()) {
|
||||
Object value = entry.getValue();
|
||||
|
||||
// 检查是否是字符串类型
|
||||
if (value instanceof String) {
|
||||
String strValue = (String) value;
|
||||
// 检查是否包含特殊字符
|
||||
for (String character : specialCharacters) {
|
||||
if (strValue.contains(character)) {
|
||||
throw new JeroBootException("输入字段中包含非法字符,请检查");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void exportSplitInfo(String cut, String idList, Map<String, Object> parameter,String exportName, HttpServletResponse response, HttpServletRequest request) {
|
||||
// 水平越权
|
||||
documentSplitService.isHorizontalOverstep(String.valueOf(parameter.get("info_id")));
|
||||
|
||||
// 防止SQL注入
|
||||
this.checkForSQLInjection(parameter);
|
||||
OutputStream os = null;
|
||||
OutputStream excelOS = null;
|
||||
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||
|
||||
Reference in New Issue
Block a user