🛡️ Sentinel: [HIGH] Fix XSS vulnerability in search.html escapeHtml

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
google-labs-jules[bot]
2026-05-31 03:03:31 +00:00
parent cc561277c9
commit 0cf8108ff0
+7 -3
View File
@@ -298,9 +298,13 @@
}
function escapeHtml(str) {
const d = document.createElement('div');
d.textContent = str;
return d.innerHTML;
if (!str) return '';
return String(str)
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#039;');
}
/**