bug:非法字符处理问题
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
package com.adc.da.xss;
|
||||
|
||||
import com.adc.da.exception.AdcDaBaseException;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SQLFilter {
|
||||
|
||||
|
||||
@@ -13,13 +19,13 @@ public class SQLFilter {
|
||||
String checkStr= str;
|
||||
checkStr = StringUtils.replace(checkStr, "\\", "");
|
||||
checkStr = checkStr.toLowerCase();
|
||||
String[] keywords = new String[]{"master", "truncate", "insert", "select", "delete", "update", "declare", "alter", "drop"};
|
||||
String[] keywords = new String[]{"master ", "truncate ", "insert ", "select ", "delete ", "update", "declare ", "alter ", "drop "};
|
||||
String[] arr$ = keywords;
|
||||
int len$ = keywords.length;
|
||||
|
||||
for(int i$ = 0; i$ < len$; ++i$) {
|
||||
String keyword = arr$[i$];
|
||||
if (checkStr.indexOf(keyword) != -1) {
|
||||
if (checkStr.contains(keyword)) {
|
||||
throw new AdcDaBaseException("包含非法字符");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user