File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,6 +106,11 @@ The module defines the following user-callable items:
106106 The latter approach is recommended as it provides assistance in automatic
107107 cleaning of the temporary file upon the context manager exit.
108108
109+ .. warning ::
110+
111+ Reopening the temporary file by name is only safe when the file's
112+ directory is trusted. See :cwe: `377 ` for more information.
113+
109114 Opening the temporary file again by its name while it is still open works as
110115 follows:
111116
@@ -409,6 +414,7 @@ Here are some examples of typical usage of the :mod:`!tempfile` module::
409414
410415 # create a temporary file using a context manager
411416 # close the file, use the name to open the file again
417+ # this is only safe if the directory cannot be modified by untrusted users
412418 >>> with tempfile.NamedTemporaryFile(delete_on_close=False) as fp:
413419 ... fp.write(b'Hello world!')
414420 ... fp.close()
You can’t perform that action at this time.
0 commit comments