pytorch / pytorch/pytorch

[Bug] Potential command injection risk (shell=True) in subprocess

Open
#169,955 2 comments 0 reactions 0 assignees View on GitHub
security triaged
Dominant language
Python
Stars
103k
Forks
29.5k
PR merge metrics
PR metrics pending

Description

### 🐛 Describe the bug

Just scan by bandit

I found something belows

https://github.com/pytorch/pytorch/blob/8acadd54d1836171f46b43177cd7aac82a7d9b3d/torch/csrc/jit/tensorexpr/scripts/bisect.py#L8-L14

https://github.com/pytorch/pytorch/blob/8acadd54d1836171f46b43177cd7aac82a7d9b3d/torch/utils/collect_env.py#L123-L125

https://github.com/pytorch/pytorch/blob/8acadd54d1836171f46b43177cd7aac82a7d9b3d/torch/utils/cpp_extension.py#L2693-L2700

This pattern is vulnerable to command injection if inputs are not strictly controlled, and it generally violates secure coding practices.

But I am not sure about it, whether to fix it or not?

CWE-78:https://cwe.mitre.org/data/definitions/78.html

### Versions

None

cc @malfet @cyyever

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.