fix(minecraft): xss mitigation for minecraft debug dashboard (#1344)

Authored-by-agent: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This commit is contained in:
Rin
2026-03-14 00:20:15 +08:00
committed by GitHub
parent a1a94371f4
commit e83c17fe57
+8 -3
View File
@@ -24,9 +24,14 @@ const SYSTEM_STATE_MARKER = 'The following blackboard provides you with informat
// =============================================================================
function escapeHtml(text) {
const div = document.createElement('div')
div.textContent = text
return div.innerHTML
if (text == null)
return ''
return String(text)
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;')
}
function formatSystemMessageContent(content) {