diagram-design
- Type
- Plugin
- Scanned
- Nov 17, 2026
- Version
- f6db0decea96
- Files read
- 509
Diagram Design is an AI agent plugin and skill that creates branded HTML and SVG diagrams, redraws draw.io, Mermaid, Excalidraw, and PlantUML files, and exports SVG or PNG images. Its biggest risk is that PNG export opens local HTML files in a hidden Chromium browser without safety checks or restrictions, allowing untrusted or manipulated diagram code to make network requests or capture other local files in the exported image.
What it can reach
- Files
- Reads local diagram files, design folders, and style guides; writes generated HTML, SVG, PNG, and JSON files along with style-guide.md and .diagram-design markers; and creates, updates, or deletes saved brand profiles in ~/.diagram-design/profiles/.
- Network
- Fetches user-provided websites during optional brand setup to extract colors and fonts, and loads Google Fonts when opening or exporting diagrams unless offline system fonts are chosen.
- Shell commands
- Runs Bash commands and instructs the AI agent to execute bundled Python scripts for diagram import, validation, diagnostics, and SVG or PNG export, plus basic file commands to manage saved brand profiles.
- Browser
- Launches a hidden Chromium browser via Playwright to convert local HTML diagrams into PNG images and run diagnostics, and can use an agent browser tool to inspect and screenshot a user-confirmed website during brand setup.
Findings
-
HighPNG export opens unvalidated HTML in Chromium with unrestricted network and file-framing access
skills/diagram-design/scripts/export_png.py:40
When exporting an HTML file to PNG, export_png.py opens the file:// URL directly in headless Chromium without running self_check.py first or blocking browser subrequests. If a user exports an untrusted HTML file from a cloned repository (or if prompt injection tricks the agent into writing unsafe HTML and exporting it), Chromium will run arbitrary inline JavaScript, issue outbound or localhost network requests (SSRF) during the 15-second network-idle wait, and render local file:// iframes (such as inside an SVG foreignObject) directly into the exported PNG screenshot.
Fix: Run self_check.verify() on the input HTML before launching Chromium, and attach a Playwright route handler (like scripts/lint-render.py does) that blocks all requests except the target file itself and HTTPS Google Fonts URLs.
-
MediumHTML parser differentials and unchecked attributes bypass self_check.py single-file safety checks
skills/diagram-design/scripts/self_check.py:199
self_check.py is used to verify that generated or imported diagram HTML contains no unauthorized scripts or remote asset loads before a user opens it in a browser, but Python's HTMLParser disagrees with browser HTML5 parsing in several ways. First, in <title><!--</title><script>...</script>--></title>, Python 3.9-3.12 HTMLParser treats the span up to --> as a comment and misses the script, whereas browsers treat <!-- as literal text inside <title>, close <title> at the first </title>, and execute the script. Second, a self-closing <style /> tag immediately closes _in_style in HTMLParser, whereas browsers ignore /> on HTML <style> tags and apply following CSS rules such as remote url() or @import loads. Third, <meta http-equiv="refresh">, <body background="https://...">, <a ping="https://...">, and root-relative srcset lists such as srcset="/x, https://..." are not rejected.
Fix: Forbid HTML comment delimiters inside RCDATA elements (<title>, <textarea>), reject self-closing /> syntax on non-void HTML tags like <style> and <script>, block <meta http-equiv>, ping, and background attributes, and validate each comma-separated candidate in srcset individually.
-
LowDeveloper icon builder fetches unpinned remote SVGs without stripping scripts or event handlers
When regenerating the icon catalog for icons not already cached locally, build-icons.py downloads SVG files from mutable Git branches (main, develop, master) and third-party logo CDNs, then extracts inner SVG markup using regexes that remove style, title, and defs tags but leave script tags, foreignObject elements, and event-handler attributes intact before writing them into assets/icons.html and references/primitive-icons.md. Installed users never run this maintainer script, and lint-skin.py skips icons.html during --all runs.
Fix: Pin upstream icon repositories to immutable commit SHAs, parse fetched SVGs with an XML parser that allowlists purely geometric tags and attributes (rejecting script, foreignObject, and on* attributes), and include assets/icons.html in lint-skin.py checks.
