Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fgqyxxlr
Overview
Overview
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
yaru
fgqyxxlr
Commits
96d0bd25
Commit
96d0bd25
authored
Feb 05, 2020
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
README
parent
f826a796
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
3 deletions
+6
-3
README.md
+1
-1
ruoyi-common/src/main/java/com/ruoyi/common/utils/html/EscapeUtil.java
+2
-0
ruoyi-common/src/main/java/com/ruoyi/common/utils/html/HTMLFilter.java
+3
-2
No files found.
README.md
View file @
96d0bd25
...
...
@@ -80,7 +80,7 @@
</tr>
<tr>
<td><img
src=
"https://oscimg.oschina.net/oscnet/bed2b98a44e7ae820c2885329e711965c28.jpg"
/></td>
<td><img
src=
"https://oscimg.oschina.net/oscnet/
5f3d39a141f21f81b90536f391b8408f1fa.jp
g"
/></td>
<td><img
src=
"https://oscimg.oschina.net/oscnet/
up-6d73c2140ce694e3de4c05035fdc1868d4c.pn
g"
/></td>
</tr>
</table>
...
...
ruoyi-common/src/main/java/com/ruoyi/common/utils/html/EscapeUtil.java
View file @
96d0bd25
...
...
@@ -145,6 +145,8 @@ public class EscapeUtil
public
static
void
main
(
String
[]
args
)
{
String
html
=
"<script>alert(1);</script>"
;
// String html = "<scr<script>ipt>alert(\"XSS\")</scr<script>ipt>";
// 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 @
96d0bd25
...
...
@@ -35,7 +35,7 @@ public final class HTMLFilter
private
static
final
Pattern
P_VALID_ENTITIES
=
Pattern
.
compile
(
"&([^&;]*)(?=(;|&|$))"
);
private
static
final
Pattern
P_VALID_QUOTES
=
Pattern
.
compile
(
"(>|^)([^<]+?)(<|$)"
,
Pattern
.
DOTALL
);
private
static
final
Pattern
P_END_ARROW
=
Pattern
.
compile
(
"^>"
);
private
static
final
Pattern
P_BODY_TO_END
=
Pattern
.
compile
(
"<([^>]*?)(?=<|$)"
);
//
private static final Pattern P_BODY_TO_END = Pattern.compile("<([^>]*?)(?=<|$)");
private
static
final
Pattern
P_XML_CONTENT
=
Pattern
.
compile
(
"(^|>)([^<]*?)(?=>)"
);
private
static
final
Pattern
P_STRAY_LEFT_ARROW
=
Pattern
.
compile
(
"<([^>]*?)(?=<|$)"
);
private
static
final
Pattern
P_STRAY_RIGHT_ARROW
=
Pattern
.
compile
(
"(^|>)([^<]*?)(?=>)"
);
...
...
@@ -245,7 +245,8 @@ 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_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