Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dlink
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
zhaowei
dlink
Commits
dc2ce689
Unverified
Commit
dc2ce689
authored
Aug 08, 2022
by
dzygcc
Committed by
GitHub
Aug 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove sensitive info for more api. (#829)
Co-authored-by:
dzygcc
<
avadar@qq.com
>
parent
8cc95731
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
SecurityAspect.java
...dmin/src/main/java/com/dlink/security/SecurityAspect.java
+29
-0
No files found.
dlink-admin/src/main/java/com/dlink/security/SecurityAspect.java
View file @
dc2ce689
...
@@ -24,6 +24,7 @@ package com.dlink.security;
...
@@ -24,6 +24,7 @@ package com.dlink.security;
import
com.dlink.common.result.ProTableResult
;
import
com.dlink.common.result.ProTableResult
;
import
com.dlink.common.result.Result
;
import
com.dlink.common.result.Result
;
import
com.dlink.model.History
;
import
com.dlink.model.History
;
import
com.dlink.model.JobInfoDetail
;
import
com.dlink.result.ExplainResult
;
import
com.dlink.result.ExplainResult
;
import
com.dlink.result.SqlExplainResult
;
import
com.dlink.result.SqlExplainResult
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.JoinPoint
;
...
@@ -53,6 +54,7 @@ public class SecurityAspect {
...
@@ -53,6 +54,7 @@ public class SecurityAspect {
public
void
afterReturning
(
JoinPoint
joinPoint
,
Object
returnValue
)
{
public
void
afterReturning
(
JoinPoint
joinPoint
,
Object
returnValue
)
{
// mask sql for explain
// mask sql for explain
// openapi/explainSql
if
(
returnValue
instanceof
Result
<?>
&&
((
Result
<?>)
returnValue
).
getDatas
()
instanceof
ExplainResult
)
{
if
(
returnValue
instanceof
Result
<?>
&&
((
Result
<?>)
returnValue
).
getDatas
()
instanceof
ExplainResult
)
{
ExplainResult
exp
=
((
ExplainResult
)
((
Result
<?>)
returnValue
).
getDatas
());
ExplainResult
exp
=
((
ExplainResult
)
((
Result
<?>)
returnValue
).
getDatas
());
List
<
SqlExplainResult
>
sqlExplainResults
=
exp
.
getSqlExplainResults
();
List
<
SqlExplainResult
>
sqlExplainResults
=
exp
.
getSqlExplainResults
();
...
@@ -65,6 +67,23 @@ public class SecurityAspect {
...
@@ -65,6 +67,23 @@ public class SecurityAspect {
}
}
}
}
// /api/studio/explainSql
if
(
returnValue
instanceof
Result
<?>
&&
((
Result
<?>)
returnValue
).
getDatas
()
instanceof
List
<?>
)
{
List
<?>
list
=
(
List
<?>)
((
Result
<?>)
returnValue
).
getDatas
();
if
(
list
.
isEmpty
()
||
!(
list
.
get
(
0
)
instanceof
SqlExplainResult
))
{
return
;
}
List
<
SqlExplainResult
>
exp
=
((
List
<
SqlExplainResult
>)
((
Result
<?>)
returnValue
).
getDatas
());
List
<
SqlExplainResult
>
sqlExplainResults
=
exp
;
if
(
CollectionUtils
.
isEmpty
(
sqlExplainResults
))
{
return
;
}
for
(
SqlExplainResult
explainResult
:
sqlExplainResults
)
{
String
sql
=
explainResult
.
getSql
();
explainResult
.
setSql
(
mask
(
sql
,
SENSITIVE
,
MASK
));
}
}
// mask statement for histories
// mask statement for histories
if
(
returnValue
instanceof
ProTableResult
<?>
&&
((
ProTableResult
<?>)
returnValue
).
getData
()
instanceof
List
<?>)
{
if
(
returnValue
instanceof
ProTableResult
<?>
&&
((
ProTableResult
<?>)
returnValue
).
getData
()
instanceof
List
<?>)
{
List
<?>
list
=
((
ProTableResult
<?>)
returnValue
).
getData
();
List
<?>
list
=
((
ProTableResult
<?>)
returnValue
).
getData
();
...
@@ -86,6 +105,16 @@ public class SecurityAspect {
...
@@ -86,6 +105,16 @@ public class SecurityAspect {
history
.
setStatement
(
mask
(
statement
,
SENSITIVE
,
MASK
));
history
.
setStatement
(
mask
(
statement
,
SENSITIVE
,
MASK
));
}
}
}
}
// /getJobInfoDetail
if
(
returnValue
instanceof
Result
<?>
&&
((
Result
<?>)
returnValue
).
getDatas
()
instanceof
JobInfoDetail
)
{
JobInfoDetail
jobInfoDetail
=
((
JobInfoDetail
)
((
Result
<?>)
returnValue
).
getDatas
());
History
history
=
jobInfoDetail
.
getHistory
();
if
(
null
!=
history
)
{
String
statement
=
history
.
getStatement
();
history
.
setStatement
(
mask
(
statement
,
SENSITIVE
,
MASK
));
}
}
}
}
...
...
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