Skip to content

Commit 9b00afb

Browse files
committed
Fix unclosed tags might cause XSS [Security Issue]
1 parent d1d6d58 commit 9b00afb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

public/js/render.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var filterXSSOptions = {
2727
whiteList: whiteList,
2828
escapeHtml: function (html) {
2929
// allow html comment in multiple lines
30-
return html.replace(/<(.*?)>/g, '&lt;$1&gt;')
30+
return html.replace(/<(?!!--)/g, '&lt;').replace(/-->/g, '__HTML_COMMENT_END__').replace(/>/g, '&gt;').replace(/__HTML_COMMENT_END__/g, '-->')
3131
},
3232
onIgnoreTag: function (tag, html, options) {
3333
// allow comment tag

0 commit comments

Comments
 (0)