[TASK] Prevent XSS in tooltip
This commit is contained in:
parent
2192500d05
commit
8bf3498744
@ -87,7 +87,7 @@ define(['leaflet', 'rbush', 'helper', 'moment'],
|
|||||||
m.on('click', function () {
|
m.on('click', function () {
|
||||||
router.fullUrl({ node: d.node_id });
|
router.fullUrl({ node: d.node_id });
|
||||||
});
|
});
|
||||||
m.bindTooltip(d.hostname);
|
m.bindTooltip(helper.escape(d.hostname));
|
||||||
|
|
||||||
dict[d.node_id] = m;
|
dict[d.node_id] = m;
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ define(['leaflet', 'rbush', 'helper', 'moment'],
|
|||||||
line.setStyle(opts);
|
line.setStyle(opts);
|
||||||
};
|
};
|
||||||
|
|
||||||
line.bindTooltip(d.source.hostname + ' – ' + d.target.hostname +
|
line.bindTooltip(helper.escape(d.source.hostname + ' – ' + d.target.hostname) +
|
||||||
'<br><strong>' + helper.showDistance(d) + ' / ' + helper.showTq(d.source_tq) + ' - ' + helper.showTq(d.target_tq) + '<br>' + d.type + '</strong>');
|
'<br><strong>' + helper.showDistance(d) + ' / ' + helper.showTq(d.source_tq) + ' - ' + helper.showTq(d.target_tq) + '<br>' + d.type + '</strong>');
|
||||||
|
|
||||||
line.on('click', function () {
|
line.on('click', function () {
|
||||||
|
@ -196,5 +196,11 @@ define({
|
|||||||
btn.classList.add('ion-full-enter');
|
btn.classList.add('ion-full-enter');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
escape: function escape(string) {
|
||||||
|
return string.replace(/</g, '<')
|
||||||
|
.replace(/>/g, '>')
|
||||||
|
.replace(/"/g, '"')
|
||||||
|
.replace(/'/g, ''');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user