T09 · Insecure Skill Coding Practices
- Location
scripts/backfill_html.py:28- Finding
Stored HTML Injection Through Unvalidated Analysis Data
- Content
View full analysis
{{SUMMARY_POSITIVE}}...{{SUMMARY_NEGATIVE}}...{{SUMMARY_DEMAND}}...{{SUMMARY_COMPETITOR}}``` ### Technical Analysis The backfill utility treats every value in the supplied analysis JSON as trusted HTML. It performs direct string replacement without: - Checking that ratio fields are integers - Enforcing an allowed numeric range - Escaping summary text - Parsing and sanitizing the permitted `- ` structure - Rejecting scripts, event-handler attributes, frames, SVG content, or dangerous URLs The workflow instructs the Agent to produce summaries in HTML format, but an instruction about the expected format is not a security boundary. Analysis data can be influenced by untrusted public comments, supplied directly through `--analysis-json`, loaded ...[truncated 1928 chars]
- Remediation
View remediation
100: raise ValueError("Ratio must be between 0 and 100") return value ``` 3. Escape every summary item with `html.escape()` and generate the allowed list markup internally: ```python import html def render_items(items): if not isinstance(items, list): raise ValueError("Summary items must be a list") return "- " + "".join(
f"
- {html.escape(str(item), quote=True)} " for item in items ) + "
