mirror of
https://github.com/chatopera/cosin.git
synced 2025-07-20 04:23:01 +08:00
fix #495 contacts notes XSS
This commit is contained in:
parent
ff7ab98bcf
commit
d803abe812
@ -181,6 +181,20 @@ block content
|
|||||||
}
|
}
|
||||||
|
|
||||||
script.
|
script.
|
||||||
|
function escapeHtml (str) {
|
||||||
|
if (typeof str == 'string') {
|
||||||
|
return str.replace(/<|&|>/g, function (matches) {
|
||||||
|
return ({
|
||||||
|
'<': '<',
|
||||||
|
'>': '>',
|
||||||
|
'&': '&'
|
||||||
|
})[matches];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
function getNotesByContactId () {
|
function getNotesByContactId () {
|
||||||
// 获取数据
|
// 获取数据
|
||||||
var id = $('#contactsId').val();
|
var id = $('#contactsId').val();
|
||||||
@ -204,8 +218,8 @@ block content
|
|||||||
'<div class="container">' +
|
'<div class="container">' +
|
||||||
'<h4>时间:' + item.updatetime + '</h4>' +
|
'<h4>时间:' + item.updatetime + '</h4>' +
|
||||||
'<h5>笔记者:' + item.creatername + '</h5>' +
|
'<h5>笔记者:' + item.creatername + '</h5>' +
|
||||||
'<h5>事件类型:' + item.category + '</h5>' +
|
'<h5>事件类型:' + escapeHtml(item.category) + '</h5>' +
|
||||||
'<div>笔记:' + item.content + '</div>' +
|
'<div>笔记:' + escapeHtml(item.content) + '</div>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'</div>');
|
'</div>');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user