Commit a7d6df93 authored by Spencer Chang's avatar Spencer Chang

[fix] 当需要限制不允许通过*查询所有列数据时,不应校验用于计算的*符号

parent 687de5d1
...@@ -106,16 +106,14 @@ public class SysDpExecuteHistoryServiceImpl extends BaseServiceImpl<SysDpExecute ...@@ -106,16 +106,14 @@ public class SysDpExecuteHistoryServiceImpl extends BaseServiceImpl<SysDpExecute
if (StringUtils.isNotEmpty(msg.toString())) { if (StringUtils.isNotEmpty(msg.toString())) {
throw new IllegalArgumentException(msg.toString()); throw new IllegalArgumentException(msg.toString());
} }
String checkMsg = SqlParserCheckUtils.parserCheckSelect(formatSql); String checkMsg = null;
msg.append(checkMsg);
// 非内部限制 // 非内部限制
if (!StringUtils.startsWith(ip, ipWhiteCheck)) { if (!StringUtils.startsWith(ip, ipWhiteCheck)) {
if (SqlCheckUtils.checkSqlIgnoreCase(formatSql, SqlConstantUtils.SQL_STAR)) { checkMsg = SqlParserCheckUtils.parserCheckSelect(formatSql, true);
msg.append("select语句不允许使用*查询所有字段,请重置语句!"); } else {
} checkMsg = SqlParserCheckUtils.parserCheckSelect(formatSql, false);
} }
msg.append(checkMsg);
if (StringUtils.isNotEmpty(msg.toString())) { if (StringUtils.isNotEmpty(msg.toString())) {
SysDpExecuteHistory sysDpExecuteHistory = new SysDpExecuteHistory(); SysDpExecuteHistory sysDpExecuteHistory = new SysDpExecuteHistory();
sysDpExecuteHistory.setDehIp(ip); sysDpExecuteHistory.setDehIp(ip);
...@@ -204,15 +202,14 @@ public class SysDpExecuteHistoryServiceImpl extends BaseServiceImpl<SysDpExecute ...@@ -204,15 +202,14 @@ public class SysDpExecuteHistoryServiceImpl extends BaseServiceImpl<SysDpExecute
if (StringUtils.isNotEmpty(msg.toString())) { if (StringUtils.isNotEmpty(msg.toString())) {
throw new IllegalArgumentException(msg.toString()); throw new IllegalArgumentException(msg.toString());
} }
String checkMsg = SqlParserCheckUtils.parserCheckSelect(formatSql); String checkMsg = null;
msg.append(checkMsg);
// 非内部限制 // 非内部限制
if (!StringUtils.startsWith(ip, ipWhiteCheck)) { if (!StringUtils.startsWith(ip, ipWhiteCheck)) {
if (SqlCheckUtils.checkSqlIgnoreCase(formatSql, SqlConstantUtils.SQL_STAR)) { checkMsg = SqlParserCheckUtils.parserCheckSelect(formatSql, true);
msg.append("select语句不允许使用*查询所有字段,请重置语句!"); } else {
} checkMsg = SqlParserCheckUtils.parserCheckSelect(formatSql, false);
} }
msg.append(checkMsg);
if (StringUtils.isNotEmpty(msg.toString())) { if (StringUtils.isNotEmpty(msg.toString())) {
sysDpExecuteHistory.setDehExecuteTime(new Date()); sysDpExecuteHistory.setDehExecuteTime(new Date());
sysDpExecuteHistory.setDehError(msg.toString()); sysDpExecuteHistory.setDehError(msg.toString());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment