Merge remote-tracking branch 'ruoyi-vue/master' into dev

# Conflicts:
#	pom.xml
#	ruoyi-common/src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java
feature/model
疯狂的狮子li 3 years ago
commit b6442b4640

@ -12,6 +12,12 @@ import lombok.NoArgsConstructor;
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class SqlUtil {
/**
* sql
*/
public static String SQL_REGEX = "select |insert |delete |update |drop |count |exec |chr |mid |master |truncate |char |and |declare ";
/**
* 线
*/
@ -33,4 +39,19 @@ public class SqlUtil {
public static boolean isValidOrderBySql(String value) {
return value.matches(SQL_PATTERN);
}
/**
* SQL
*/
public static void filterKeyword(String value) {
if (StringUtils.isEmpty(value)) {
return;
}
String[] sqlKeywords = StringUtils.split(SQL_REGEX, "\\|");
for (String sqlKeyword : sqlKeywords) {
if (StringUtils.indexOfIgnoreCase(value, sqlKeyword) > -1) {
throw new UtilException("参数存在SQL注入风险");
}
}
}
}

Loading…
Cancel
Save