Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
guns-vip
Commits
e0f97b14
Commit
e0f97b14
authored
Sep 04, 2017
by
stylefeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
通知管理内容接受html
parent
06ced613
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
4 deletions
+24
-4
guns-admin/src/main/java/com/stylefeng/guns/config/web/WebConfig.java
+4
-1
guns-admin/src/main/webapp/static/modular/system/notice/notice_info.js
+1
-1
guns-core/src/main/java/com/stylefeng/guns/core/xss/XssFilter.java
+19
-2
No files found.
guns-admin/src/main/java/com/stylefeng/guns/config/web/WebConfig.java
View file @
e0f97b14
...
...
@@ -19,6 +19,7 @@ import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.context.request.RequestContextListener
;
import
java.util.Arrays
;
import
java.util.Properties
;
/**
...
...
@@ -100,7 +101,9 @@ public class WebConfig {
*/
@Bean
public
FilterRegistrationBean
xssFilterRegistration
()
{
FilterRegistrationBean
registration
=
new
FilterRegistrationBean
(
new
XssFilter
());
XssFilter
xssFilter
=
new
XssFilter
();
xssFilter
.
setUrlExclusion
(
Arrays
.
asList
(
"/notice/update"
,
"/notice/add"
));
FilterRegistrationBean
registration
=
new
FilterRegistrationBean
(
xssFilter
);
registration
.
addUrlPatterns
(
"/*"
);
return
registration
;
}
...
...
guns-admin/src/main/webapp/static/modular/system/notice/notice_info.js
View file @
e0f97b14
...
...
@@ -54,7 +54,7 @@ NoticeInfoDlg.close = function () {
* 收集数据
*/
NoticeInfoDlg
.
collectData
=
function
()
{
this
.
noticeInfoData
[
'content'
]
=
NoticeInfoDlg
.
editor
.
txt
.
text
();
this
.
noticeInfoData
[
'content'
]
=
NoticeInfoDlg
.
editor
.
txt
.
html
();
this
.
set
(
'id'
).
set
(
'title'
);
}
...
...
guns-core/src/main/java/com/stylefeng/guns/core/xss/XssFilter.java
View file @
e0f97b14
...
...
@@ -4,12 +4,15 @@ package com.stylefeng.guns.core.xss;
import
javax.servlet.*
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.IOException
;
import
java.util.List
;
public
class
XssFilter
implements
Filter
{
FilterConfig
filterConfig
=
null
;
private
List
<
String
>
urlExclusion
=
null
;
public
void
init
(
FilterConfig
filterConfig
)
throws
ServletException
{
this
.
filterConfig
=
filterConfig
;
}
...
...
@@ -19,8 +22,21 @@ public class XssFilter implements Filter {
}
public
void
doFilter
(
ServletRequest
request
,
ServletResponse
response
,
FilterChain
chain
)
throws
IOException
,
ServletException
{
chain
.
doFilter
(
new
XssHttpServletRequestWrapper
(
(
HttpServletRequest
)
request
),
response
);
HttpServletRequest
httpServletRequest
=
(
HttpServletRequest
)
request
;
String
servletPath
=
httpServletRequest
.
getServletPath
();
if
(
urlExclusion
!=
null
&&
urlExclusion
.
contains
(
servletPath
))
{
chain
.
doFilter
(
request
,
response
);
}
else
{
chain
.
doFilter
(
new
XssHttpServletRequestWrapper
((
HttpServletRequest
)
request
),
response
);
}
}
public
List
<
String
>
getUrlExclusion
()
{
return
urlExclusion
;
}
public
void
setUrlExclusion
(
List
<
String
>
urlExclusion
)
{
this
.
urlExclusion
=
urlExclusion
;
}
}
\ No newline at end of file
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