Merge branch 'master' of gitee.com:y_project/RuoYi-Cloud

pull/131/head
thinkcodee 4 years ago
commit 4dc250d899

@ -33,7 +33,7 @@
<commons.io.version>2.11.0</commons.io.version>
<commons.fileupload.version>1.4</commons.fileupload.version>
<velocity.version>2.3</velocity.version>
<fastjson.version>1.2.78</fastjson.version>
<fastjson.version>1.2.79</fastjson.version>
<jjwt.version>0.9.1</jjwt.version>
<minio.version>8.2.2</minio.version>
<poi.version>4.1.2</poi.version>

@ -10,6 +10,11 @@ import com.ruoyi.common.core.utils.StringUtils;
*/
public class SqlUtil
{
/**
* sql
*/
public static String SQL_REGEX = "select |insert |delete |update |drop |count |exec |chr |mid |master |truncate |char |and |declare ";
/**
* 线
*/
@ -34,4 +39,23 @@ public class SqlUtil
{
return value.matches(SQL_PATTERN);
}
/**
* SQL
*/
public static void filterKeyword(String value)
{
if (StringUtils.isEmpty(value))
{
return;
}
String[] sqlKeywords = StringUtils.split(SQL_REGEX, "\\|");
for (int i = 0; i < sqlKeywords.length; i++)
{
if (StringUtils.indexOfIgnoreCase(value, sqlKeywords[i]) > -1)
{
throw new UtilException("参数存在SQL注入风险");
}
}
}
}

Loading…
Cancel
Save