T09 · Insecure Skill Coding Practices
- Location
scripts/render_card.py:282- Finding
Untrusted Markdown Is Rendered as Active Browser Content
- Content
View full analysis
{css}{md_html}""" return html ``` The resulting document is then opened in a browser: ```python # Write HTML to temp file with tempfile.NamedTemporaryFile( mode="w", suffix=".html", delete=False, encoding="utf-8" ) as f: f.write(html) temp_html = f.name try: screenshot_path = hti.screenshot( html_file=temp_html, save_as=os.path.basename(output_path), size=(width + 80, 1600), # Will auto-crop ) ``` ### Technical Analysis The renderer treats the contents of the input Markdown file as untrusted data, but passes them directly to `markdown.markdown()` and inserts the resulting value into a complete HTML document. Python-Markdown permits raw HTML in Markdown input by default; none of the configured extensions sanitize that HTML. The generated document is subsequently opened by a real Chrome or Edge browser through `html2image`. No HTML allowlist, Content Security Policy, browser network restriction, or raw-HTML rejection is appl ...[truncated 2284 chars]- Remediation
View remediation
``` 4. Run the rendering browser without external network access, such as inside a sandboxed container or network namespace. 5. Use a dedicated, low-privilege operating-system account with no access to credentials or sensitive workspace files. 6. Apply strict input-size limits and browser execution timeouts to reduce denial-of-service exposure. 7. Add security tests using raw `
