subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
f.write(mermaid_code) # 调用 mmdc 转换 result = subprocess.run( ["mmdc", "-i", str(temp_mmd), "-o", str(temp_svg), "-t", "default", "-w", "800"], capture_output=True, text=True,- Confidence
- 83% confidence
- Finding
- The script writes untrusted Mermaid content from the Markdown file to a temporary file and passes it to an external renderer (mmdc). Although subprocess.run is used safely without shell=True, the real risk is delegated parsing of attacker-controlled diagram content by a large external toolchain, which can expose the host to parser bugs, SSRF-like fetches, local file access, or sandbox escape depending on mermaid-cli/Puppeteer behavior and configuration.
