T09 · Insecure Skill Coding Practices
- Location
assets/templates/quality_dashboard.html:294- Finding
DOM-Based Cross-Site Scripting Through Unsanitized Dashboard Data
- Content
View full analysis
` ${g.name} ${g.standard} ${g.actual} ${g.pass ? 'Passed' : 'Failed'} `).join(''); document.getElementById('quality-gates').innerHTML = gatesHtml; // Risk table if (data.risks.length > 0) { document.getElementById('risk-table').innerHTML = data.risks.map(r => ` ${r.name} ${r.level} ${r.status} `).join(''); } ``` The English words shown in this excerpt correspond to the Chinese display labels in the original template; the executable interpolation and `innerHTML` operations are unchanged. ### Technical Analysis The `updateDashboard(data)` function interpolates the following data fields directly into HTML strings: - `data.qualityGates[].name` - `data.qualityGates[].standard` - `data.qualityGates[].actual` - `data.risks[].name` - `data.risks[].level` - `data.risks[].status` The generated strings are assigned to `Element.innerHTML` without contextual encoding, sanitization, or schema validation. Consequently, HTML supplied through any of these properties is parsed as markup rather than displayed as text. The template currently initializes the function with static sample data. However, the source comment explicitly indicates that this data can be replaced by an API data source. If API responses, imported reports, defect descriptions, risk names, pipeline metadata, or other externally influenced values are passed to `update ...[truncated 2413 chars]- Remediation
View remediation
