T09 · Insecure Skill Coding Practices
- Location
scripts/generate.py:38- Finding
Untrusted configuration values are rendered as active HTML in Chromium
- Content
View full analysis
{t}' for t in f_tags) services_html = "" for i, s in enumerate(services, 1): services_html += f"""""" who_html = "" for w in for_who: who_html += f"""0{i}{s['title']}
{s.get('tag','')}{s['desc']}
""" perks_html = "".join(f"{w['icon']}{w['title']}
{w['desc']}
- {p}
" for p in perks) ``` The generated document is subsequently opened by Chromium: ```python def screenshot(html_content: str, output_path: str) -> bool: with tempfile.NamedTemporaryFile( mode="w", suffix=".html", delete=False, encoding="utf-8" ) as f: f.write(html_content) tmp = f.name try: r = subprocess.run( ["playwright", "screenshot", "--browser", "chromium", "--full-page", "--viewport-size", "750,900", f"file://{tmp}", output_path], capture_output=True, text=True, timeout=60 ) ``` ### Technical Analysis Configuration values are inserted directly into an HTML document without contextual escaping or sanitization. This applies to scalar fields and nested fields such as founder tags, service titles and descriptions, target-audience entries, and perks. Although some fields intentionally support limited markup such as `` and `
`, the implementation does not enforce such an allowlist. An attacker who can create or influence the configuration can insert ...[truncated 2149 chars]- Remediation
View remediation
` and `
`. Reject: - Script and style elements - Iframes and embedded objects - Event-handler attributes - URL-bearing elements and attributes - Arbitrary CSS 3. Validate the JSON schema before rendering. Enforce expected types, maximum lengths, collection sizes, and allowed values. 4. Disable network access for the rendering process where possible. Alternatively, intercept Chromium requests and permit only local resources required for poster generation. 5. Run Chromium in a restricted environment with: - No access to sensitive internal networks - A read-only filesystem except for dedicated temporary and output directories - No unnecessary host credentials - Current browser security updates and sandboxing enabled 6. Add security tests using payloads containing `
