T09 · Insecure Skill Coding Practices
- Location
scripts/export_report.py:218- Finding
Stored HTML Injection Through Imported Glucose Record Fields
- Content
View full analysis
{timestamp} {value} {unit} {meal_context} {notes} """ ``` ### Technical Analysis Fields originating from a CSV or Excel file are converted to strings and persisted without validation or HTML output encoding. When an HTML report is generated, `meal_context`, `notes`, `unit`, and other record values are interpolated directly into the document. An attacker-controlled field can therefore contain active HTML, such as: ```html``` When the generated report is opened in a browser, the browser interprets the value as markup rather than text. This is a stored injection because the payload is first persisted in the glucose data file and subsequently rendered by the report exporter. Although the generated report is normally a local file, active content can still manipulate the report, present deceptive medical information, initiate network requests, or execute JavaScript with the privileges and ...[truncated 1248 chars]
- Remediation
View remediation
``` 5. Validate units and meal contexts against explicit allowlists. 6. Add regression tests containing characters such as `<`, `>`, `"`, `'`, and payload-like strings, and verify that they are rendered as visible text rather than markup. ]]>
