Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ioc_sixiang_license
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
zengtianlai3
ioc_sixiang_license
Commits
e635106b
Commit
e635106b
authored
Jul 17, 2022
by
zengtianlai3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xss 存储型测试
parent
b84bb84a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
0 deletions
+69
-0
UserController.java
...n/java/iot/sixiang/license/controller/UserController.java
+3
-0
BeanCopyUtil.java
...e/src/main/java/iot/sixiang/license/xss/BeanCopyUtil.java
+48
-0
BeanCopyUtilCallBack.java
...in/java/iot/sixiang/license/xss/BeanCopyUtilCallBack.java
+18
-0
No files found.
license/src/main/java/iot/sixiang/license/controller/UserController.java
View file @
e635106b
...
@@ -17,6 +17,7 @@ import iot.sixiang.license.model.PageResult;
...
@@ -17,6 +17,7 @@ import iot.sixiang.license.model.PageResult;
import
iot.sixiang.license.model.vo.UserVo
;
import
iot.sixiang.license.model.vo.UserVo
;
import
iot.sixiang.license.service.UserService
;
import
iot.sixiang.license.service.UserService
;
import
iot.sixiang.license.util.CommonUtil
;
import
iot.sixiang.license.util.CommonUtil
;
import
iot.sixiang.license.xss.XssUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.WebDataBinder
;
import
org.springframework.web.bind.WebDataBinder
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -79,6 +80,8 @@ public class UserController {
...
@@ -79,6 +80,8 @@ public class UserController {
@PostMapping
(
"delete"
)
@PostMapping
(
"delete"
)
@MyLog
(
title
=
"删除用户"
,
optParam
=
"#{userId}"
,
businessType
=
BusinessType
.
DELETE
)
@MyLog
(
title
=
"删除用户"
,
optParam
=
"#{userId}"
,
businessType
=
BusinessType
.
DELETE
)
public
BaseResult
deleteUser
(
@RequestParam
(
"userId"
)
int
userId
)
{
public
BaseResult
deleteUser
(
@RequestParam
(
"userId"
)
int
userId
)
{
userId
=
Integer
.
valueOf
(
XssUtil
.
checkXSS
(
String
.
valueOf
(
userId
)));
boolean
res
=
userService
.
deleteUser
(
userId
);
boolean
res
=
userService
.
deleteUser
(
userId
);
if
(
res
)
{
if
(
res
)
{
return
BaseResult
.
success
();
return
BaseResult
.
success
();
...
...
license/src/main/java/iot/sixiang/license/xss/BeanCopyUtil.java
0 → 100644
View file @
e635106b
package
iot
.
sixiang
.
license
.
xss
;
import
org.springframework.beans.BeanUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.function.Supplier
;
/**
* @Author m33
* @Date 2022/7/17 11:42
* @Description
*/
public
class
BeanCopyUtil
extends
BeanUtils
{
/**
* 集合数据的拷贝
* @param sources: 数据源类
* @param target: 目标类::new(eg: UserVO::new)
* @return
*/
public
static
<
S
,
T
>
List
<
T
>
copyListProperties
(
List
<
S
>
sources
,
Supplier
<
T
>
target
)
{
return
copyListProperties
(
sources
,
target
,
null
);
}
/**
* 带回调函数的集合数据的拷贝(可自定义字段拷贝规则)
* @param sources: 数据源类
* @param target: 目标类::new(eg: UserVO::new)
* @param callBack: 回调函数
* @return
*/
public
static
<
S
,
T
>
List
<
T
>
copyListProperties
(
List
<
S
>
sources
,
Supplier
<
T
>
target
,
BeanCopyUtilCallBack
<
S
,
T
>
callBack
)
{
List
<
T
>
list
=
new
ArrayList
<>(
sources
.
size
());
for
(
S
source
:
sources
)
{
T
t
=
target
.
get
();
copyProperties
(
source
,
t
);
list
.
add
(
t
);
if
(
callBack
!=
null
)
{
// 回调
callBack
.
callBack
(
source
,
t
);
}
}
return
list
;
}
}
license/src/main/java/iot/sixiang/license/xss/BeanCopyUtilCallBack.java
0 → 100644
View file @
e635106b
package
iot
.
sixiang
.
license
.
xss
;
/**
* @Author m33
* @Date 2022/7/17 11:43
* @Description
*/
@FunctionalInterface
public
interface
BeanCopyUtilCallBack
<
S
,
T
>
{
/**
* 定义默认回调方法
* @param t
* @param s
*/
void
callBack
(
S
t
,
T
s
);
}
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