Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Spencer Chang
dp
Commits
a7d6df93
Commit
a7d6df93
authored
Aug 26, 2020
by
Spencer Chang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] 当需要限制不允许通过*查询所有列数据时,不应校验用于计算的*符号
parent
687de5d1
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
13 deletions
+10
-13
SysDpExecuteHistoryServiceImpl.java
...-code/dp/service/impl/SysDpExecuteHistoryServiceImpl.java
+10
-13
SqlParserCheckUtils.java
v2-多线程版本/java-code/dp/util/SqlParserCheckUtils.java
+0
-0
No files found.
v2-多线程版本/java-code/dp/service/impl/SysDpExecuteHistoryServiceImpl.java
View file @
a7d6df93
...
...
@@ -106,16 +106,14 @@ public class SysDpExecuteHistoryServiceImpl extends BaseServiceImpl<SysDpExecute
if
(
StringUtils
.
isNotEmpty
(
msg
.
toString
()))
{
throw
new
IllegalArgumentException
(
msg
.
toString
());
}
String
checkMsg
=
SqlParserCheckUtils
.
parserCheckSelect
(
formatSql
);
msg
.
append
(
checkMsg
);
String
checkMsg
=
null
;
// 非内部限制
if
(!
StringUtils
.
startsWith
(
ip
,
ipWhiteCheck
))
{
if
(
SqlCheckUtils
.
checkSqlIgnoreCase
(
formatSql
,
SqlConstantUtils
.
SQL_STAR
))
{
msg
.
append
(
"select语句不允许使用*查询所有字段,请重置语句!"
);
}
checkMsg
=
SqlParserCheckUtils
.
parserCheckSelect
(
formatSql
,
true
);
}
else
{
checkMsg
=
SqlParserCheckUtils
.
parserCheckSelect
(
formatSql
,
false
);
}
msg
.
append
(
checkMsg
);
if
(
StringUtils
.
isNotEmpty
(
msg
.
toString
()))
{
SysDpExecuteHistory
sysDpExecuteHistory
=
new
SysDpExecuteHistory
();
sysDpExecuteHistory
.
setDehIp
(
ip
);
...
...
@@ -204,15 +202,14 @@ public class SysDpExecuteHistoryServiceImpl extends BaseServiceImpl<SysDpExecute
if
(
StringUtils
.
isNotEmpty
(
msg
.
toString
()))
{
throw
new
IllegalArgumentException
(
msg
.
toString
());
}
String
checkMsg
=
SqlParserCheckUtils
.
parserCheckSelect
(
formatSql
);
msg
.
append
(
checkMsg
);
String
checkMsg
=
null
;
// 非内部限制
if
(!
StringUtils
.
startsWith
(
ip
,
ipWhiteCheck
))
{
if
(
SqlCheckUtils
.
checkSqlIgnoreCase
(
formatSql
,
SqlConstantUtils
.
SQL_STAR
))
{
msg
.
append
(
"select语句不允许使用*查询所有字段,请重置语句!"
);
}
checkMsg
=
SqlParserCheckUtils
.
parserCheckSelect
(
formatSql
,
true
);
}
else
{
checkMsg
=
SqlParserCheckUtils
.
parserCheckSelect
(
formatSql
,
false
);
}
msg
.
append
(
checkMsg
);
if
(
StringUtils
.
isNotEmpty
(
msg
.
toString
()))
{
sysDpExecuteHistory
.
setDehExecuteTime
(
new
Date
());
sysDpExecuteHistory
.
setDehError
(
msg
.
toString
());
...
...
v2-多线程版本/java-code/dp/util/SqlParserCheckUtils.java
View file @
a7d6df93
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment