mirror of
https://gitee.com/beecue/fastbee.git
synced 2026-09-20 20:02:06 +08:00
fix(漏洞): 新闻、通知加xss过滤
This commit is contained in:
@@ -3,6 +3,7 @@ package com.fastbee.iot.service.impl;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.fastbee.common.utils.DateUtils;
|
||||
import com.fastbee.common.utils.html.RichTextSanitizer;
|
||||
import com.fastbee.iot.mapper.NewsCategoryMapper;
|
||||
import com.fastbee.iot.model.CategoryNews;
|
||||
import com.fastbee.iot.model.IdAndName;
|
||||
@@ -88,6 +89,7 @@ public class NewsServiceImpl implements INewsService
|
||||
@Override
|
||||
public int insertNews(News news)
|
||||
{
|
||||
news.setContent(RichTextSanitizer.sanitize(news.getContent()));
|
||||
news.setCreateTime(DateUtils.getNowDate());
|
||||
return newsMapper.insertNews(news);
|
||||
}
|
||||
@@ -101,6 +103,7 @@ public class NewsServiceImpl implements INewsService
|
||||
@Override
|
||||
public int updateNews(News news)
|
||||
{
|
||||
news.setContent(RichTextSanitizer.sanitize(news.getContent()));
|
||||
news.setUpdateTime(DateUtils.getNowDate());
|
||||
return newsMapper.updateNews(news);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
update news
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="title != null and title != ''">title = #{title},</if>
|
||||
<if test="content != null and content != ''">content = #{content},</if>
|
||||
<if test="content != null">content = #{content},</if>
|
||||
<if test="imgUrl != null and imgUrl != ''">img_url = #{imgUrl},</if>
|
||||
<if test="isTop != null">is_top = #{isTop},</if>
|
||||
<if test="isBanner != null">is_banner = #{isBanner},</if>
|
||||
@@ -124,4 +124,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{newsId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.fastbee.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.common.utils.html.RichTextSanitizer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fastbee.system.domain.SysNotice;
|
||||
@@ -51,6 +52,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService
|
||||
@Override
|
||||
public int insertNotice(SysNotice notice)
|
||||
{
|
||||
notice.setNoticeContent(RichTextSanitizer.sanitize(notice.getNoticeContent()));
|
||||
return noticeMapper.insertNotice(notice);
|
||||
}
|
||||
|
||||
@@ -63,6 +65,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService
|
||||
@Override
|
||||
public int updateNotice(SysNotice notice)
|
||||
{
|
||||
notice.setNoticeContent(RichTextSanitizer.sanitize(notice.getNoticeContent()));
|
||||
return noticeMapper.updateNotice(notice);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user