Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sts网站
Project
Project
Details
Activity
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
liyang
sts网站
Commits
1ffb6379
Commit
1ffb6379
authored
Jul 06, 2023
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
排序属性orderBy参数限制长度
parent
4d5c204b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
SqlUtil.java
...mon/src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java
+9
-0
No files found.
ruoyi-common/src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java
View file @
1ffb6379
...
@@ -20,6 +20,11 @@ public class SqlUtil
...
@@ -20,6 +20,11 @@ public class SqlUtil
*/
*/
public
static
String
SQL_PATTERN
=
"[a-zA-Z0-9_\\ \\,\\.]+"
;
public
static
String
SQL_PATTERN
=
"[a-zA-Z0-9_\\ \\,\\.]+"
;
/**
* 限制orderBy最大长度
*/
private
static
final
int
ORDER_BY_MAX_LENGTH
=
500
;
/**
/**
* 检查字符,防止注入绕过
* 检查字符,防止注入绕过
*/
*/
...
@@ -29,6 +34,10 @@ public class SqlUtil
...
@@ -29,6 +34,10 @@ public class SqlUtil
{
{
throw
new
UtilException
(
"参数不符合规范,不能进行查询"
);
throw
new
UtilException
(
"参数不符合规范,不能进行查询"
);
}
}
if
(
StringUtils
.
length
(
value
)
>
ORDER_BY_MAX_LENGTH
)
{
throw
new
UtilException
(
"参数已超过最大限制,不能进行查询"
);
}
return
value
;
return
value
;
}
}
...
...
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