T09 · Insecure Skill Coding Practices
- Location
assets/viewer.html:120- Finding
DOM-Based Cross-Site Scripting Through Unsafely Reconstructed Heading Attributes
- Content
View full analysis
无标题'; return []; } const usedIds = new Set(); const items = []; let minLevel = 6; headings.forEach((h) => { const level = parseInt(h.tagName.slice(1), 10); if (level < minLevel) minLevel = level; if (!h.id) { let base = slugify(h.textContent); let id = base; let i = 2; while (usedIds.has(id) || document.getElementById(id)) { id = base + "-" + i++; } h.id = id; } usedIds.add(h.id); items.push({ id: h.id, text: h.textContent, level, el: h }); }); list.innerHTML = '- ' + items.map((it) => {
const indent = (it.level - minLevel) * 12;
return `
- ${escapeHtml(it.text)} `; }).join("") + '
- Remediation
View remediation
