Merge pull request #901 from christianlouis/sentinel-fix-xss-search-14130401506656403756
🛡️ Sentinel: [HIGH] Fix XSS vulnerability in search.html escapeHtml
This commit is contained in:
@@ -298,9 +298,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function escapeHtml(str) {
|
function escapeHtml(str) {
|
||||||
const d = document.createElement('div');
|
if (str === null || str === undefined) return '';
|
||||||
d.textContent = str;
|
return String(str)
|
||||||
return d.innerHTML;
|
.replace(/&/g, '&')
|
||||||
|
.replace(/</g, '<')
|
||||||
|
.replace(/>/g, '>')
|
||||||
|
.replace(/"/g, '"')
|
||||||
|
.replace(/'/g, ''');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user