Tainted flow: 'out_path' from os.environ.get (line 50, credential/environment) → open (file write)
Medium
- Category
- Data Flow
- Content
# 输出文件 safe_title = title.replace("/", "_").replace("\\", "_") out_path = OUTPUT_DIR / f"{safe_title}.drawio" with open(out_path, "w", encoding="utf-8") as f: f.write(xml) print(f"✅ 生成成功: {out_path}")- Confidence
- 93% confidence
- Finding
- The script trusts DRAWIO_OUTPUT_DIR from the environment and writes the generated .drawio file to that location without constraining it to an approved base directory. In an agent or automation context, a caller who can influence environment variables can redirect output to arbitrary filesystem locations, causing unintended file creation or overwrite within the privileges of the process.
