[3.9] gh-118486: Support mkdir(mode=0o700) on Windows (GH-118488) (GH-118741)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This commit is contained in:
Steve Dower 2024-05-24 18:27:01 +01:00 committed by GitHub
parent b228655c22
commit 5130731c9e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 107 additions and 3 deletions

View file

@ -1929,6 +1929,10 @@ features:
platform-dependent. On some platforms, they are ignored and you should call
:func:`chmod` explicitly to set them.
On Windows, a *mode* of ``0o700`` is specifically handled to apply access
control to the new directory such that only the current user and
administrators have access. Other values of *mode* are ignored.
This function can also support :ref:`paths relative to directory descriptors
<dir_fd>`.
@ -1943,6 +1947,9 @@ features:
.. versionchanged:: 3.6
Accepts a :term:`path-like object`.
.. versionchanged:: 3.9.20
Windows now handles a *mode* of ``0o700``.
.. function:: makedirs(name, mode=0o777, exist_ok=False)

View file

@ -613,6 +613,13 @@ Added :func:`os.waitstatus_to_exitcode` function:
convert a wait status to an exit code.
(Contributed by Victor Stinner in :issue:`40094`.)
As of 3.9.20, :func:`os.mkdir` and :func:`os.makedirs` on Windows now support
passing a *mode* value of ``0o700`` to apply access control to the new
directory. This implicitly affects :func:`tempfile.mkdtemp` and is a
mitigation for CVE-2024-4030. Other values for *mode* continue to be
ignored.
(Contributed by Steve Dower in :gh:`118486`.)
pathlib
-------
@ -704,6 +711,14 @@ Previously, :attr:`sys.stderr` was block-buffered when non-interactive. Now
``stderr`` defaults to always being line-buffered.
(Contributed by Jendrik Seipp in :issue:`13601`.)
tempfile
--------
As of 3.9.20 on Windows, the default mode ``0o700`` used by
:func:`tempfile.mkdtemp` now limits access to the new directory due to
changes to :func:`os.mkdir`. This is a mitigation for CVE-2024-4030.
(Contributed by Steve Dower in :gh:`118486`.)
tracemalloc
-----------