T09 · Insecure Skill Coding Practices
- Location
scripts/drawio2html.py:164- Finding
Stored HTML and SVG Injection Through Unescaped Diagram Content
- Content
View full analysis
{e["value"]}') ``` Node labels are also inserted directly into SVG text elements: ```python # Lines 197-202 lines = v['value'].split('\n') line_height = 16 start_y = y + h / 2 - (len(lines) - 1) * line_height / 2 + 5 for idx, line in enumerate(lines): ty = start_y + idx * line_height svg_parts.append(f' {line}') ``` The unescaped diagram name and generated SVG are embedded directly into the final HTML document: ```python # Lines 207-209 html_doc = f''' ``` ```python # Line 234 {diagram_name} ``` ```python # Lines 255-259{diagram_name}
{svg_content} ``` Style-derived colors are also accepted without a strict allowlist and inserted into SVG attributes: ```python def parse_color(c): """Parse drawio color to CSS color.""" if not c: ...[truncated 3427 chars]- Remediation
View remediation
