subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
# 自动整改:把本轮缺口作为上下文交给 refine 命令,产出下一版产物 gap_txt = "; ".join(g["rectify"] for g in res["gaps"]) cmd = a.refine_cmd.replace("{artifact}", cur).replace("{gaps}", gap_txt) r = subprocess.run(cmd, shell=True, capture_output=True, text=True) nxt = (r.stdout or "").strip().splitlines() nxt = nxt[-1] if nxt else "" if nxt and os.path.exists(nxt):- Confidence
- 99% confidence
- Finding
- The loop mode builds a shell command from user-controlled inputs and executes it with shell=True. Both {artifact} and {gaps} can carry shell metacharacters into the final command, enabling arbitrary command execution in the context of the process.
