Skip to content

Commit 224689f

Browse files
vdyeGit for Windows Build Agent
authored and
Git for Windows Build Agent
committed
Merge tag 'v2.35.2.windows.1'
Git for Windows v2.35.2 Changes since Git for Windows v2.35.1(2) (February 1st 2022) This version addresses CVE-2022-24765 and CVE-2022-24767. New Features * Comes with Git v2.35.2. Bug Fixes * The uninstaller was hardened to avoid a vulnerability when running under the SYSTEM account, addressing CVE-2022-24767. Signed-off-by: Victoria Dye <[email protected]>
2 parents a85aa4a + 359938d commit 224689f

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

Documentation/config/safe.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ directory was listed in the `safe.directory` list. If `safe.directory=*`
2626
is set in system config and you want to re-enable this protection, then
2727
initialize your list with an empty value before listing the repositories
2828
that you deem safe.
29+
+
30+
Due to the permission model on Windows where ACLs are used instead of
31+
Unix' simpler permission model, it can be a bit tricky to figure out why
32+
a directory is considered unsafe. To help with this, Git will provide
33+
more detailed information when the environment variable
34+
`GIT_TEST_DEBUG_UNSAFE_DIRECTORIES` is set to `true`.

compat/mingw.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "../git-compat-util.h"
22
#include "win32.h"
33
#include <aclapi.h>
4+
#include <sddl.h>
45
#include <conio.h>
56
#include <wchar.h>
67
#include <winioctl.h>
@@ -3513,6 +3514,7 @@ int is_path_owned_by_current_sid(const char *path)
35133514
else if (sid && IsValidSid(sid)) {
35143515
/* Now, verify that the SID matches the current user's */
35153516
static PSID current_user_sid;
3517+
BOOL is_member;
35163518

35173519
if (!current_user_sid)
35183520
current_user_sid = get_current_user_sid();
@@ -3521,6 +3523,35 @@ int is_path_owned_by_current_sid(const char *path)
35213523
IsValidSid(current_user_sid) &&
35223524
EqualSid(sid, current_user_sid))
35233525
result = 1;
3526+
else if (IsWellKnownSid(sid, WinBuiltinAdministratorsSid) &&
3527+
CheckTokenMembership(NULL, sid, &is_member) &&
3528+
is_member)
3529+
/*
3530+
* If owned by the Administrators group, and the
3531+
* current user is an administrator, we consider that
3532+
* okay, too.
3533+
*/
3534+
result = 1;
3535+
else if (git_env_bool("GIT_TEST_DEBUG_UNSAFE_DIRECTORIES", 0)) {
3536+
LPSTR str1, str2, to_free1 = NULL, to_free2 = NULL;
3537+
3538+
if (ConvertSidToStringSidA(sid, &str1))
3539+
to_free1 = str1;
3540+
else
3541+
str1 = "(inconvertible)";
3542+
3543+
if (!current_user_sid)
3544+
str2 = "(none)";
3545+
else if (!IsValidSid(current_user_sid))
3546+
str2 = "(invalid)";
3547+
else if (ConvertSidToStringSidA(current_user_sid, &str2))
3548+
to_free2 = str2;
3549+
else
3550+
str2 = "(inconvertible)";
3551+
warning("'%s' is owned by:\n\t'%s'\nbut the current user is:\n\t'%s'", path, str1, str2);
3552+
LocalFree(to_free1);
3553+
LocalFree(to_free2);
3554+
}
35243555
}
35253556

35263557
/*

0 commit comments

Comments
 (0)