home *** CD-ROM | disk | FTP | other *** search
- <TITLE>Caring about security -- Python library reference</TITLE>
- Next: <A HREF="../i/installing_your_cgi_script_on_a_unix_system" TYPE="Next">Installing your CGI script on a Unix system</A>
- Prev: <A HREF="../f/functions" TYPE="Prev">Functions</A>
- Up: <A HREF="../c/cgi" TYPE="Up">cgi</A>
- Top: <A HREF="../t/top" TYPE="Top">Top</A>
- <H2>10.1.5. Caring about security</H2>
- There's one important rule: if you invoke an external program (e.g.
- via the <CODE>os.system()</CODE> or <CODE>os.popen()</CODE> 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!
- <P>
- 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.
- <P>
-