Yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/node209.html

From ZCubes Wiki
Revision as of 18:40, 7 November 2013 by MassBot1 (talk | contribs) (Created page with "<div class="navigation"> {| width="100%" cellspacing="2" align="center" | yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/node210.html|[[Image:yurttas_PL_...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

11.1.5 Caring about security

There's one important rule: if you invoke an external program (e.g. via the os.system() or os.popen() functions), make very sure you don't pass arbitrary strings received from the client to the shell. This is a well-known security hole whereby clever hackers anywhere on the web can exploit a gullible CGI script to invoke arbitrary shell commands. Even parts of the URL or field names cannot be trusted, since the request doesn't have to come from your form!

To be on the safe side, if you must pass a string gotten from a form to a shell command, you should make sure the string contains only alphanumeric characters, dashes, underscores, and periods.


Send comments on this document to python-docs@python.org.