Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"shell=True" in subprocess call + env variables is susceptible to shell injection. #31

Open
BenCasses opened this issue May 15, 2017 · 2 comments
Assignees

Comments

@BenCasses
Copy link
Contributor

for example, need to change all of these:
output = subprocess.check_output("scontrol show hostnames \"$SLURM_NODELIST\" | tr '\n' ','", shell=True)
to these:
subprocess.check_output(["scontrol","show","hostnames",os.environ["SLURM_NODELIST"]]).replace("\n"," ")[:-1]
In this specific case, the quotes around $SLURM_NODELIST appear to condition adequately, but I think in general it is unsafe to use "shell=True" when unncessary.

@cadejager
Copy link
Collaborator

Great, are you making these changes or should I

@BenCasses
Copy link
Contributor Author

I'll get them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants