Pre Merge pull request !403 from yi-l-i-yi-li/master
This commit is contained in:
commit
53425793e6
|
|
@ -12,6 +12,8 @@ public class SqlUtil
|
|||
{
|
||||
/**
|
||||
* 定义常用的 sql关键字
|
||||
* 删除管道符 "|"左边的空格,空格会导致sql注入
|
||||
* chr |mid |char |and | 去掉空格容易引起误报
|
||||
*/
|
||||
public static String SQL_REGEX = "select|insert|delete|update|drop|count|exec|chr |mid |master|truncate|char |and |declare";
|
||||
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ public class GenController extends BaseController
|
|||
{
|
||||
try
|
||||
{
|
||||
SqlUtil.filterKeyword(sql);
|
||||
//SqlUtil.filterKeyword(sql);
|
||||
List<SQLStatement> sqlStatements = SQLUtils.parseStatements(sql, DbType.mysql);
|
||||
List<String> tableNames = new ArrayList<>();
|
||||
for (SQLStatement sqlStatement : sqlStatements)
|
||||
|
|
@ -207,6 +207,8 @@ public class GenController extends BaseController
|
|||
if (sqlStatement instanceof MySqlCreateTableStatement)
|
||||
{
|
||||
MySqlCreateTableStatement createTableStatement = (MySqlCreateTableStatement) sqlStatement;
|
||||
//关键字过滤
|
||||
SqlUtil.filterKeyword(createTableStatement.toString());
|
||||
if (genTableService.createTable(createTableStatement.toString()))
|
||||
{
|
||||
String tableName = createTableStatement.getTableName().replaceAll("`", "");
|
||||
|
|
|
|||
Loading…
Reference in New Issue