subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
f"data = YAML.load_file({json.dumps(str(path))}); " "puts JSON.generate(data)" ) raw = subprocess.check_output(["ruby", "-e", ruby], text=True) return json.loads(raw)- Confidence
- 87% confidence
- Finding
- The script invokes an external Ruby interpreter to parse YAML, which introduces an avoidable command-execution dependency and expands the attack surface. More importantly, it uses Ruby's YAML.load_file, which is historically unsafe for untrusted YAML because it can deserialize arbitrary objects and trigger dangerous behavior depending on the runtime and available classes; if the anchor-map file is attacker-controlled, this can lead to code execution or other unsafe side effects.
