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:
Christian Krakau-Louis
2026-05-31 06:35:57 +02:00
committed by GitHub
+7 -3
View File
@@ -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, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#039;');
} }
/** /**