-
-
Notifications
You must be signed in to change notification settings - Fork 704
Closed
Description
test_executable runs various executables in /tmp. When running a script, Python puts the directory containing that script in sys.path. Therefore, it is trivial for any user to have code executed by the user running the doctests. For example:
[eviluser@hostname ~]$ echo 'print "EVIL!!"' > /tmp/socket.py
...
[vbraun@hostname ~]$ sage -t -force_lib devel/sage/sage/tests/cmdline.py
sage -t -force_lib "devel/sage/sage/tests/cmdline.py"
**********************************************************************
File "/home/vbraun/opt/sage-5.4.beta1/devel/sage/sage/tests/cmdline.py", line 248:
sage: print out
Expected:
1
Got:
EVIL!!
test_executable should securely create a temp directory and run the executable in there.
Apply:
- attachment: 13579_sagelib.patch to the Sage library.
- attachment: 13579_scripts.patch to Sage scripts (
local/bin). - new spkg: http://boxen.math.washington.edu/home/jdemeyer/spkg/python-2.7.3.p1.spkg (patch added: attachment: sys_path_security.patch)
Reported upstream: http://bugs.python.org/issue16202
See also: ipython/ipython#7044
Upstream: Reported upstream. No feedback yet.
CC: @jdemeyer
Component: doctest coverage
Author: Jeroen Demeyer, Volker Braun
Reviewer: Volker Braun, Jeroen Demeyer, David Roe
Merged: sage-5.4.rc2
Issue created by migration from https://trac.sagemath.org/ticket/13579