home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / p / python / pyhtmldoc / c / caring_abo < prev    next >
Encoding:
Text File  |  1996-11-14  |  1.0 KB  |  19 lines

  1. <TITLE>Caring about security -- Python library reference</TITLE>
  2. Next: <A HREF="../i/installing_your_cgi_script_on_a_unix_system" TYPE="Next">Installing your CGI script on a Unix system</A>  
  3. Prev: <A HREF="../f/functions" TYPE="Prev">Functions</A>  
  4. Up: <A HREF="../c/cgi" TYPE="Up">cgi</A>  
  5. Top: <A HREF="../t/top" TYPE="Top">Top</A>  
  6. <H2>10.1.5. Caring about security</H2>
  7. There's one important rule: if you invoke an external program (e.g.
  8. via the <CODE>os.system()</CODE> or <CODE>os.popen()</CODE> functions), make very sure you don't
  9. pass arbitrary strings received from the client to the shell.  This is
  10. a well-known security hole whereby clever hackers anywhere on the web
  11. can exploit a gullible CGI script to invoke arbitrary shell commands.
  12. Even parts of the URL or field names cannot be trusted, since the
  13. request doesn't have to come from your form!
  14. <P>
  15. To be on the safe side, if you must pass a string gotten from a form
  16. to a shell command, you should make sure the string contains only
  17. alphanumeric characters, dashes, underscores, and periods.
  18. <P>
  19.