[Python-checkins] cpython (3.1): Issue #16248: Disable code execution from the user's home directory by tkinter

benjamin.peterson python-checkins at python.org
Sun Dec 9 16:17:51 CET 2012


http://hg.python.org/cpython/rev/03b3124e9ea3
changeset:   80782:03b3124e9ea3
branch:      3.1
parent:      76255:5a6fa1b8767f
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Sun Dec 09 14:46:18 2012 +0100
summary:
  Issue #16248: Disable code execution from the user's home directory by tkinter when the -E flag is passed to Python.
Patch by Zachary Ware.

files:
  Lib/tkinter/__init__.py |  4 +++-
  Misc/NEWS               |  3 +++
  2 files changed, 6 insertions(+), 1 deletions(-)


diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py
--- a/Lib/tkinter/__init__.py
+++ b/Lib/tkinter/__init__.py
@@ -1632,7 +1632,9 @@
         self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
         if useTk:
             self._loadtk()
-        self.readprofile(baseName, className)
+        if not sys.flags.ignore_environment:
+            # Issue #16248: Honor the -E flag to avoid code injection.
+            self.readprofile(baseName, className)
     def loadtk(self):
         if not self._tkloaded:
             self.tk.loadtk()
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -13,6 +13,9 @@
 Library
 -------
 
+- Issue #16248: Disable code execution from the user's home directory by tkinter
+  when the -E flag is passed to Python.
+
 
 What's New in Python 3.1.5?
 ===========================

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list