Fix CVE-2023-40590 · gitpython-developers/GitPython@5e77467 · GitHub
Skip to content

Commit 5e77467

Browse files
committed
This fixes the path search bug where the current directory is included on Windows, by setting NoDefaultCurrentDirectoryInExePath for the caller. (Setting for the callee env would not work.) This sets it only on Windows, only for the duration of the Popen call, and then automatically unsets it or restores its old value. NoDefaultCurrentDirectoryInExePath is documented at: https://learn.microsoft.com/en-us/windows/win32/api/processenv/nf-processenv-needcurrentdirectoryforexepatha It automatically affects the behavior of subprocess.Popen on Windows, due to the way Popen uses the Windows API. (In contrast, it does not, at least currently on CPython, affect the behavior of shutil.which. But shutil.which is not being used to find git.exe.)
1 parent e19abe7 commit 5e77467

1 file changed

Lines changed: 21 additions & 17 deletions

File tree

git/cmd.py

Lines changed: 21 additions & 17 deletions

0 commit comments

Comments
 (0)