[Python-ideas] shutil.runret and shutil.runout
mwm at mired.org
Fri Feb 24 13:59:51 CET 2012
On Fri, 24 Feb 2012 22:19:07 +1000
Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Fri, Feb 24, 2012 at 10:13 PM, Mike Meyer <mwm at mired.org> wrote:
> > How about adding your new function to subprocess, except instead of
> > passing them to the shell, they use shlex to parse them, then call
> > Popen with the appropriate arguments? shlex might need some work for
> > this.
This module aims to take over where subprocess leaves off,
providing convenient, low-level access to the system shell, that
automatically handles filenames and paths containing whitespace,
as well as protecting naive code from shell injection
That's a backwards approach to security. Rather than allowing anything
and turning off what you know isn't safe, you should disallow
everything and turn on what you know is safe. So rather than trying to
make the strings you pass to the shell safe, you should parse them
yourself and avoid calling the shell at all.
Mike Meyer <mwm at mired.org> http://www.mired.org/
Independent Software developer/SCM consultant, email for more information.
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
More information about the Python-ideas