Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
finance-manage
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
finance-oa
finance-manage
Commits
22225a51
Commit
22225a51
authored
Jul 28, 2020
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HTML过滤器改为将html转义
parent
fe030cc0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
ruoyi-common/src/main/java/com/ruoyi/common/utils/html/EscapeUtil.java
...src/main/java/com/ruoyi/common/utils/html/EscapeUtil.java
+4
-1
ruoyi-common/src/main/java/com/ruoyi/common/utils/html/HTMLFilter.java
...src/main/java/com/ruoyi/common/utils/html/HTMLFilter.java
+3
-2
No files found.
ruoyi-common/src/main/java/com/ruoyi/common/utils/html/EscapeUtil.java
View file @
22225a51
...
...
@@ -144,7 +144,10 @@ public class EscapeUtil
public
static
void
main
(
String
[]
args
)
{
String
html
=
"alert('11111');"
;
String
html
=
"<script>alert(1);</script>"
;
// String html = "<scr<script>ipt>alert(\"XSS\")</scr<script>ipt>";
// String html = "<123";
// String html = "123>";
System
.
out
.
println
(
EscapeUtil
.
clean
(
html
));
System
.
out
.
println
(
EscapeUtil
.
escape
(
html
));
System
.
out
.
println
(
EscapeUtil
.
unescape
(
html
));
...
...
ruoyi-common/src/main/java/com/ruoyi/common/utils/html/HTMLFilter.java
View file @
22225a51
...
...
@@ -131,7 +131,7 @@ public final class HTMLFilter
vAllowedEntities
=
new
String
[]
{
"amp"
,
"gt"
,
"lt"
,
"quot"
};
stripComment
=
true
;
encodeQuotes
=
true
;
alwaysMakeTags
=
tru
e
;
alwaysMakeTags
=
fals
e
;
}
/**
...
...
@@ -208,7 +208,7 @@ public final class HTMLFilter
s
=
processRemoveBlanks
(
s
);
s
=
validateEntities
(
s
);
//
s = validateEntities(s);
return
s
;
}
...
...
@@ -245,6 +245,7 @@ public final class HTMLFilter
// try and form html
//
s
=
regexReplace
(
P_END_ARROW
,
""
,
s
);
// 不追加结束标签
s
=
regexReplace
(
P_BODY_TO_END
,
"<$1>"
,
s
);
s
=
regexReplace
(
P_XML_CONTENT
,
"$1<$2"
,
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