subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
cmd = [node_bin, mmd_js, "-i", mmd_file, "-o", out_name, "-b", "transparent", "-t", "default"] # mmdc 在工作目录输出 subprocess.run(cmd, cwd=out_dir, env=env, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) finally: os.unlink(mmd_file)- Confidence
- 93% confidence
- Finding
- The code executes an external Mermaid CLI via subprocess using document-controlled diagram content and an output path derived from user input. Although it avoids shell=True, invoking a browser/Node-based renderer expands the trust boundary and can expose the host to parser bugs, unexpected networked behavior in dependencies, or execution of unreviewed local toolchains.
