[Python-checkins] python/dist/src/Doc/lib librexec.tex,1.14.12.1,1.14.12.2

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Fri, 31 May 2002 14:19:55 -0700


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv1688/Doc/lib

Modified Files:
      Tag: release21-maint
	librexec.tex 
Log Message:
Backport to 2.1.x:

SF bug 533625 (Armin Rigo). rexec: potential security hole

If a rexec instance allows writing in the current directory (a common
thing to do), there's a way to execute bogus bytecode.  Fix this by
not allowing imports from .pyc files (in a way that allows a site to
configure things so that .pyc files *are* allowed, if writing is not
allowed).


Index: librexec.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/librexec.tex,v
retrieving revision 1.14.12.1
retrieving revision 1.14.12.2
diff -C2 -d -r1.14.12.1 -r1.14.12.2
*** librexec.tex	22 Jun 2001 18:22:10 -0000	1.14.12.1
--- librexec.tex	31 May 2002 21:19:53 -0000	1.14.12.2
***************
*** 211,214 ****
--- 211,226 ----
  \end{memberdesc}
  
+ \begin{memberdesc}{ok_file_types}
+ Contains the file types from which modules are allowed to be loaded.
+ Each file type is an integer constant defined in the \refmodule{imp} module.
+ The meaningful values are \constant{PY_SOURCE}, \constant{PY_COMPILED}, and
+ \constant{C_EXTENSION}.  The value for \class{RExec} is \code{(C_EXTENSION,
+ PY_SOURCE)}.  Adding \constant{PY_COMPILED} in subclasses is not recommended;
+ an attacker could exit the restricted execution mode by putting a forged
+ byte-compiled file (\file{.pyc}) anywhere in your file system, for example
+ by writing it to \file{/tmp} or uploading it to the \file{/incoming}
+ directory of your public FTP server.
+ \end{memberdesc}
+ 
  
  \subsection{An example}