Repository navigation
Closed
Labels
3.10 (EOL)end of life3.11only security fixes3.8 (EOL)end of life3.9 (EOL)end of lifeOS-windowsstdlibStandard Library Python modules in the Lib/ directorytype-securityA security issue
Description
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee = None
closed_at = <Date 2021-08-29.12:57:59.497>
created_at = <Date 2020-11-06.14:57:52.124>
labels = ['type-security', '3.8', '3.9', '3.10', '3.11', 'library', 'OS-windows']
title = 'Remove usage of tempfile.mktemp in stdlib'
updated_at = <Date 2021-08-29.12:57:59.496>
user = 'https://github.com/E-Paine'bugs.python.org fields:
activity = <Date 2021-08-29.12:57:59.496>
actor = 'lukasz.langa'
assignee = 'none'
closed = True
closed_date = <Date 2021-08-29.12:57:59.497>
closer = 'lukasz.langa'
components = ['Library (Lib)', 'Windows']
creation = <Date 2020-11-06.14:57:52.124>
creator = 'epaine'
dependencies = []
files = []
hgrepos = []
issue_num = 42278
keywords = ['patch']
message_count = 11.0
messages = ['380450', '380535', '380537', '380553', '381168', '386232', '400524', '400529', '400530', '400531', '400532']
nosy_count = 11.0
nosy_names = ['paul.moore', 'eric.smith', 'tim.golden', 'eric.araujo', 'lukasz.langa', 'zach.ware', 'serhiy.storchaka', 'steve.dower', 'dstufft', 'miss-islington', 'epaine']
pr_nums = ['23200', '28024', '28025', '28026']
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'security'
url = 'https://bugs.python.org/issue42278'
versions = ['Python 3.8', 'Python 3.9', 'Python 3.10', 'Python 3.11']Metadata
Metadata
Assignees
Labels
3.10 (EOL)end of life3.11only security fixes3.8 (EOL)end of life3.9 (EOL)end of lifeOS-windowsstdlibStandard Library Python modules in the Lib/ directorytype-securityA security issue
Activity
E-Paine commentedon Nov 6, 2020
Currently, there are many uses of
tempfile.mktempin the stdlib. I couldn't find an issue where this has already been discussed, but I think the usage of mktemp in the stdlib should be completely reviewed. I grepped the Lib and a slightly filtered version is the following:Lib/asyncio/windows_utils.py:34: address = tempfile.mktemp( Lib/distutils/command/bdist_wininst.py:185: archive_basename = mktemp() Lib/distutils/util.py:386: (script_fd, script_name) = None, mktemp(".py") Lib/msilib/__init__.py:214: filename = mktemp() Lib/multiprocessing/connection.py:81: return tempfile.mktemp(prefix='listener-', dir=util.get_temp_dir()) Lib/multiprocessing/connection.py:83: return tempfile.mktemp(prefix=r'\.\pipe\pyc-%d-%d-' % Lib/pydoc.py:1620: filename = tempfile.mktemp() Lib/test/bisect_cmd.py:75: tmp = tempfile.mktemp() Lib/test/test_bytes.py:1193: tfn = tempfile.mktemp() Lib/test/test_contextlib.py:316: tfn = tempfile.mktemp() Lib/test/test_doctest.py:2724: >>> fn = tempfile.mktemp() Lib/test/test_doctest.py:2734: >>> fn = tempfile.mktemp() Lib/test/test_doctest.py:2744: >>> fn = tempfile.mktemp() Lib/test/test_faulthandler.py:51: filename = tempfile.mktemp() Lib/test/test_shutil.py:1624: filename = tempfile.mktemp(dir=dirname) Lib/test/test_shutil.py:1935: dst_dir = tempfile.mktemp(dir=self.mkdtemp()) Lib/test/test_shutil.py:2309: name = tempfile.mktemp(dir=os.getcwd()) Lib/test/test_shutil.py:272: filename = tempfile.mktemp(dir=self.mkdtemp()) Lib/test/test_shutil.py:677: dst = tempfile.mktemp(dir=self.mkdtemp()) Lib/test/test_socket.py:699: path = tempfile.mktemp(dir=self.dir_path) Lib/test/test_socketserver.py:100: fn = tempfile.mktemp(prefix='unix_socket.', dir=dir)I am hoping this issue will be spotted as I couldn't find who to add to the nosy for this. I think, bearing in mind that use of this method is a security issue, we should reduce this number as low as feasible (though, I am sure that a number of those will have good reasons for using mktemp, and will be doing so in a safe way).
10 remaining items
ambv commentedon Aug 29, 2021
New changeset c9227df by E-Paine in branch 'main':
bpo-42278: Use tempfile.TemporaryDirectory rather than tempfile.mktemp in pydoc (GH-23200)
c9227df
ambv commentedon Aug 29, 2021
New changeset 4540951 by Miss Islington (bot) in branch '3.9':
bpo-42278: Use tempfile.TemporaryDirectory rather than tempfile.mktemp in pydoc (GH-23200) (GH-28025)
4540951
ambv commentedon Aug 29, 2021
New changeset 193443b by Miss Islington (bot) in branch '3.8':
bpo-42278: Use tempfile.TemporaryDirectory rather than tempfile.mktemp in pydoc (GH-23200) (GH-28026)
193443b
miss-islington commentedon Aug 29, 2021
New changeset 532ebba by Miss Islington (bot) in branch '3.10':
bpo-42278: Use tempfile.TemporaryDirectory rather than tempfile.mktemp in pydoc (GH-23200)
532ebba
ambv commentedon Aug 29, 2021
Thanks, E. Paine! ✨ 🍰 ✨