Skip to content

Commit 1f65dd6

Browse files
committed
Git 2.33.3
Signed-off-by: Junio C Hamano <[email protected]>
2 parents 87ed4fc + 1530434 commit 1f65dd6

File tree

9 files changed

+100
-5
lines changed

9 files changed

+100
-5
lines changed

Documentation/RelNotes/2.30.4.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Git v2.30.4 Release Notes
2+
=========================
3+
4+
This release contains minor fix-ups for the changes that went into
5+
Git 2.30.3, which was made to address CVE-2022-24765.
6+
7+
* The code that was meant to parse the new `safe.directory`
8+
configuration variable was not checking what configuration
9+
variable was being fed to it, which has been corrected.
10+
11+
* '*' can be used as the value for the `safe.directory` variable to
12+
signal that the user considers that any directory is safe.
13+
14+
15+
16+
Derrick Stolee (2):
17+
t0033: add tests for safe.directory
18+
setup: opt-out of check with safe.directory=*
19+
20+
Matheus Valadares (1):
21+
setup: fix safe.directory key not being checked

Documentation/RelNotes/2.31.3.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Git Documentation/RelNotes/2.31.3.txt Release Notes
2+
=========================
3+
4+
This release merges up the fixes that appear in v2.31.3.

Documentation/RelNotes/2.32.2.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Git Documentation/RelNotes/2.32.2.txt Release Notes
2+
=========================
3+
4+
This release merges up the fixes that appear in v2.32.2.

Documentation/RelNotes/2.33.3.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Git Documentation/RelNotes/2.33.3.txt Release Notes
2+
=========================
3+
4+
This release merges up the fixes that appear in v2.33.3.

Documentation/config/safe.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,10 @@ line option `-c safe.directory=<path>`.
1919
The value of this setting is interpolated, i.e. `~/<path>` expands to a
2020
path relative to the home directory and `%(prefix)/<path>` expands to a
2121
path relative to Git's (runtime) prefix.
22+
+
23+
To completely opt-out of this security check, set `safe.directory` to the
24+
string `*`. This will allow all repositories to be treated as if their
25+
directory was listed in the `safe.directory` list. If `safe.directory=*`
26+
is set in system config and you want to re-enable this protection, then
27+
initialize your list with an empty value before listing the repositories
28+
that you deem safe.

GIT-VERSION-GEN

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
GVF=GIT-VERSION-FILE
4-
DEF_VER=v2.33.2
4+
DEF_VER=v2.33.3
55

66
LF='
77
'

RelNotes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Documentation/RelNotes/2.33.2.txt
1+
Documentation/RelNotes/2.33.3.txt

setup.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,9 +1035,14 @@ static int safe_directory_cb(const char *key, const char *value, void *d)
10351035
{
10361036
struct safe_directory_data *data = d;
10371037

1038-
if (!value || !*value)
1038+
if (strcmp(key, "safe.directory"))
1039+
return 0;
1040+
1041+
if (!value || !*value) {
10391042
data->is_safe = 0;
1040-
else {
1043+
} else if (!strcmp(value, "*")) {
1044+
data->is_safe = 1;
1045+
} else {
10411046
const char *interpolated = NULL;
10421047

10431048
if (!git_config_pathname(&interpolated, key, value) &&
@@ -1054,7 +1059,8 @@ static int ensure_valid_ownership(const char *path)
10541059
{
10551060
struct safe_directory_data data = { .path = path };
10561061

1057-
if (is_path_owned_by_current_user(path))
1062+
if (!git_env_bool("GIT_TEST_ASSUME_DIFFERENT_OWNER", 0) &&
1063+
is_path_owned_by_current_user(path))
10581064
return 1;
10591065

10601066
read_very_early_config(safe_directory_cb, &data);

t/t0033-safe-directory.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/sh
2+
3+
test_description='verify safe.directory checks'
4+
5+
. ./test-lib.sh
6+
7+
GIT_TEST_ASSUME_DIFFERENT_OWNER=1
8+
export GIT_TEST_ASSUME_DIFFERENT_OWNER
9+
10+
expect_rejected_dir () {
11+
test_must_fail git status 2>err &&
12+
grep "safe.directory" err
13+
}
14+
15+
test_expect_success 'safe.directory is not set' '
16+
expect_rejected_dir
17+
'
18+
19+
test_expect_success 'safe.directory does not match' '
20+
git config --global safe.directory bogus &&
21+
expect_rejected_dir
22+
'
23+
24+
test_expect_success 'path exist as different key' '
25+
git config --global foo.bar "$(pwd)" &&
26+
expect_rejected_dir
27+
'
28+
29+
test_expect_success 'safe.directory matches' '
30+
git config --global --add safe.directory "$(pwd)" &&
31+
git status
32+
'
33+
34+
test_expect_success 'safe.directory matches, but is reset' '
35+
git config --global --add safe.directory "" &&
36+
expect_rejected_dir
37+
'
38+
39+
test_expect_success 'safe.directory=*' '
40+
git config --global --add safe.directory "*" &&
41+
git status
42+
'
43+
44+
test_expect_success 'safe.directory=*, but is reset' '
45+
git config --global --add safe.directory "" &&
46+
expect_rejected_dir
47+
'
48+
49+
test_done

0 commit comments

Comments
 (0)