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

Using Popen('gmsh ...', shell=True) rather than shell=False security danger #362

Closed
wd15 opened this issue Sep 19, 2014 · 2 comments
Closed

Comments

@wd15
Copy link
Contributor

wd15 commented Sep 19, 2014

In commit 1634eb6, Popen('gmsh ...', shell=True) is used instead of shell=False. The python docs seem to think that this is big security issue, but does it matter?

The change was made so that if FiPy is executed in a virtualenv, the local version of gmsh not the system version is used. For some reason using shell=False results in the local environment being ignored (i.e. the local PATH). I tried playing with the env argument to Popen, but to no avail.
The following script is helpful for debugging

from subprocess import Popen, PIPE
import os

print os.getenv("PATH")
print os.environ["PATH"]

p = Popen(["gmsh", "--version"], stderr=PIPE, shell=False, env=dict(os.environ))
##p = Popen("gmsh --version", stderr=PIPE, shell=True, env=dict(os.environ))

out, verStr = p.communicate()
verStr = verStr.decode('ascii').strip('\n')

print verStr

Imported from trac ticket #486, created by wd15 on 12-18-2012 at 12:05, last modified: 12-18-2012 at 13:58

@wd15
Copy link
Contributor Author

wd15 commented Sep 19, 2014

This ticket was a red herring. The issue was with the "fake" gmsh script used to override the system gmsh for a bare install. Everything has been returned to how it was before. The script needed a "#!" at the top. See 20f82d6

Trac comment by wd15 on 12-18-2012 at 13:19

@guyer
Copy link
Member

guyer commented Sep 19, 2014

Not "fixed"

Trac comment by guyer on 12-18-2012 at 13:58

@wd15 wd15 closed this as completed Sep 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants