]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-150368: Change Windows user group to secure identifier in test_tempfile (#150369)
authorDawid Konrad Kohnke <51542233+anytokin@users.noreply.github.com>
Mon, 1 Jun 2026 11:35:48 +0000 (13:35 +0200)
committerGitHub <noreply@github.com>
Mon, 1 Jun 2026 11:35:48 +0000 (11:35 +0000)
Lib/test/test_tempfile.py

index 0e00ff1d0cc3665c9bb0475bee626e43c5c3ec30..3b081ecd4a3aa50c0d7fad85026841732424a6db 100644 (file)
@@ -332,7 +332,9 @@ class TestBadTempdir:
         with _inside_empty_temp_dir():
             probe = os.path.join(tempfile.tempdir, 'probe')
             if os.name == 'nt':
-                cmd = ['icacls', tempfile.tempdir, '/deny', 'Everyone:(W)']
+                # Use security identifier *S-1-1-0 instead
+                # of localized "Everyone" to not depend on the locale.
+                cmd = ['icacls', tempfile.tempdir, '/deny', '*S-1-1-0:(W)']
                 stdout = None if support.verbose > 1 else subprocess.DEVNULL
                 subprocess.run(cmd, check=True, stdout=stdout)
             else:
@@ -355,7 +357,9 @@ class TestBadTempdir:
                     self.make_temp()
             finally:
                 if os.name == 'nt':
-                    cmd = ['icacls', tempfile.tempdir, '/grant:r', 'Everyone:(M)']
+                    # Use security identifier *S-1-1-0 instead
+                    # of localized "Everyone" to not depend on the locale.
+                    cmd = ['icacls', tempfile.tempdir, '/grant:r', '*S-1-1-0:(M)']
                     subprocess.run(cmd, check=True, stdout=stdout)
                 else:
                     os.chmod(tempfile.tempdir, oldmode)