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

Prefer os.subprocess.call() to os.system() #5

Open
callunity opened this issue Dec 18, 2019 · 0 comments
Open

Prefer os.subprocess.call() to os.system() #5

callunity opened this issue Dec 18, 2019 · 0 comments

Comments

@callunity
Copy link

callunity commented Dec 18, 2019

Describe the bug

os.system() presents security vulnerabilities. The Python docs indicate that using the subprocess module is preferred.

To Reproduce

See 5 instances of os.system() in ConsensusCruncher.py

Additional considerations

Existing os.subprocess.call invocations in ConsensusCruncher.py create a string and then split it on spaces. This could be dangerous if any of the strings being passed in to the .format() call contain spaces. This could be mitigated by converting lines like this:

call("{} index {}/{}.sorted.bam".format(args.samtools, bam_dir, filename).split(' '))

To:

call([args.samtools, "index", "{}/{}.sorted.bam".format(bam_dir, filename)])
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

1 participant