Skip to content

Commit 067cfe2

Browse files
committed
Fix to escape html comment tag [Security Issue]
Signed-off-by: Max Wu <[email protected]>
1 parent b89a351 commit 067cfe2

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
@@ -45,7 +45,7 @@ var filterXSSOptions = {
4545
// allow comment tag
4646
if (tag === '!--') {
4747
// do not filter its attributes
48-
return html
48+
return html.replace(/<(?!!--)/g, '&lt;').replace(/-->/g, '__HTML_COMMENT_END__').replace(/>/g, '&gt;').replace(/__HTML_COMMENT_END__/g, '-->')
4949
}
5050
},
5151
onTagAttr: function (tag, name, value, isWhiteAttr) {

0 commit comments

Comments
 (0)