fix: innerHTML XSS in extension content script and sidepanel (MEDIUM-01)

- content.js: replace innerHTML with createElement/textContent for ref panel
- sidepanel.js: escape entry.command with escapeHtml() in activity feed
- Both found by security audit + Codex adversarial red team
This commit is contained in:
Garry Tan
2026-03-27 22:13:59 -07:00
parent af462bf97a
commit 929190c588
+10 -1
View File
@@ -103,7 +103,16 @@ function renderRefPanel(refs) {
for (const ref of refs.slice(0, 30)) { // Show max 30 in panel
const row = document.createElement('div');
row.className = 'gstack-ref-panel-row';
row.innerHTML = `<span class="gstack-ref-panel-id">${ref.ref}</span> <span class="gstack-ref-panel-role">${ref.role}</span> <span class="gstack-ref-panel-name">"${ref.name}"</span>`;
const idSpan = document.createElement('span');
idSpan.className = 'gstack-ref-panel-id';
idSpan.textContent = ref.ref;
const roleSpan = document.createElement('span');
roleSpan.className = 'gstack-ref-panel-role';
roleSpan.textContent = ref.role;
const nameSpan = document.createElement('span');
nameSpan.className = 'gstack-ref-panel-name';
nameSpan.textContent = '"' + ref.name + '"';
row.append(idSpan, document.createTextNode(' '), roleSpan, document.createTextNode(' '), nameSpan);
list.appendChild(row);
}
if (refs.length > 30) {