Skip to content

Commit 93a88f4

Browse files
committed
Sync with 2.39.4
* maint-2.39: (38 commits) Git 2.39.4 fsck: warn about symlink pointing inside a gitdir core.hooksPath: add some protection while cloning init.templateDir: consider this config setting protected clone: prevent hooks from running during a clone Add a helper function to compare file contents init: refactor the template directory discovery into its own function find_hook(): refactor the `STRIP_EXTENSION` logic clone: when symbolic links collide with directories, keep the latter entry: report more colliding paths t5510: verify that D/F confusion cannot lead to an RCE submodule: require the submodule path to contain directories only clone_submodule: avoid using `access()` on directories submodules: submodule paths must not contain symlinks clone: prevent clashing git dirs when cloning submodule in parallel t7423: add tests for symlinked submodule directories has_dir_name(): do not get confused by characters < '/' docs: document security issues around untrusted .git dirs upload-pack: disable lazy-fetching by default fetch/clone: detect dubious ownership of local repositories ...
2 parents 6741e91 + 47b6d90 commit 93a88f4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1307
-123
lines changed

.github/workflows/check-whitespace.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
check-whitespace:
2020
runs-on: ubuntu-latest
2121
steps:
22-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
2323
with:
2424
fetch-depth: 0
2525

.github/workflows/main.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
echo "skip_concurrent=$skip_concurrent" >>$GITHUB_OUTPUT
4747
- name: skip if the commit or tree was already tested
4848
id: skip-if-redundant
49-
uses: actions/github-script@v6
49+
uses: actions/github-script@v7
5050
if: steps.check-ref.outputs.enabled == 'yes'
5151
with:
5252
github-token: ${{secrets.GITHUB_TOKEN}}
@@ -95,7 +95,7 @@ jobs:
9595
group: windows-build-${{ github.ref }}
9696
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
9797
steps:
98-
- uses: actions/checkout@v3
98+
- uses: actions/checkout@v4
9999
- uses: git-for-windows/setup-git-for-windows-sdk@v1
100100
- name: build
101101
shell: bash
@@ -106,7 +106,7 @@ jobs:
106106
- name: zip up tracked files
107107
run: git archive -o artifacts/tracked.tar.gz HEAD
108108
- name: upload tracked files and build artifacts
109-
uses: actions/upload-artifact@v3
109+
uses: actions/upload-artifact@v4
110110
with:
111111
name: windows-artifacts
112112
path: artifacts
@@ -123,7 +123,7 @@ jobs:
123123
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
124124
steps:
125125
- name: download tracked files and build artifacts
126-
uses: actions/download-artifact@v3
126+
uses: actions/download-artifact@v4
127127
with:
128128
name: windows-artifacts
129129
path: ${{github.workspace}}
@@ -140,7 +140,7 @@ jobs:
140140
run: ci/print-test-failures.sh
141141
- name: Upload failed tests' directories
142142
if: failure() && env.FAILED_TEST_ARTIFACTS != ''
143-
uses: actions/upload-artifact@v3
143+
uses: actions/upload-artifact@v4
144144
with:
145145
name: failed-tests-windows
146146
path: ${{env.FAILED_TEST_ARTIFACTS}}
@@ -156,10 +156,10 @@ jobs:
156156
group: vs-build-${{ github.ref }}
157157
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
158158
steps:
159-
- uses: actions/checkout@v3
159+
- uses: actions/checkout@v4
160160
- uses: git-for-windows/setup-git-for-windows-sdk@v1
161161
- name: initialize vcpkg
162-
uses: actions/checkout@v3
162+
uses: actions/checkout@v4
163163
with:
164164
repository: 'microsoft/vcpkg'
165165
path: 'compat/vcbuild/vcpkg'
@@ -195,7 +195,7 @@ jobs:
195195
- name: zip up tracked files
196196
run: git archive -o artifacts/tracked.tar.gz HEAD
197197
- name: upload tracked files and build artifacts
198-
uses: actions/upload-artifact@v3
198+
uses: actions/upload-artifact@v4
199199
with:
200200
name: vs-artifacts
201201
path: artifacts
@@ -213,7 +213,7 @@ jobs:
213213
steps:
214214
- uses: git-for-windows/setup-git-for-windows-sdk@v1
215215
- name: download tracked files and build artifacts
216-
uses: actions/download-artifact@v3
216+
uses: actions/download-artifact@v4
217217
with:
218218
name: vs-artifacts
219219
path: ${{github.workspace}}
@@ -231,7 +231,7 @@ jobs:
231231
run: ci/print-test-failures.sh
232232
- name: Upload failed tests' directories
233233
if: failure() && env.FAILED_TEST_ARTIFACTS != ''
234-
uses: actions/upload-artifact@v3
234+
uses: actions/upload-artifact@v4
235235
with:
236236
name: failed-tests-windows
237237
path: ${{env.FAILED_TEST_ARTIFACTS}}
@@ -262,11 +262,11 @@ jobs:
262262
pool: ubuntu-20.04
263263
- jobname: osx-clang
264264
cc: clang
265-
pool: macos-12
265+
pool: macos-13
266266
- jobname: osx-gcc
267267
cc: gcc
268-
cc_package: gcc-9
269-
pool: macos-12
268+
cc_package: gcc-13
269+
pool: macos-13
270270
- jobname: linux-gcc-default
271271
cc: gcc
272272
pool: ubuntu-latest
@@ -286,15 +286,15 @@ jobs:
286286
runs_on_pool: ${{matrix.vector.pool}}
287287
runs-on: ${{matrix.vector.pool}}
288288
steps:
289-
- uses: actions/checkout@v3
289+
- uses: actions/checkout@v4
290290
- run: ci/install-dependencies.sh
291291
- run: ci/run-build-and-tests.sh
292292
- name: print test failures
293293
if: failure() && env.FAILED_TEST_ARTIFACTS != ''
294294
run: ci/print-test-failures.sh
295295
- name: Upload failed tests' directories
296296
if: failure() && env.FAILED_TEST_ARTIFACTS != ''
297-
uses: actions/upload-artifact@v3
297+
uses: actions/upload-artifact@v4
298298
with:
299299
name: failed-tests-${{matrix.vector.jobname}}
300300
path: ${{env.FAILED_TEST_ARTIFACTS}}
@@ -320,9 +320,9 @@ jobs:
320320
runs-on: ubuntu-latest
321321
container: ${{matrix.vector.image}}
322322
steps:
323-
- uses: actions/checkout@v3
323+
- uses: actions/checkout@v4
324324
if: matrix.vector.jobname != 'linux32'
325-
- uses: actions/checkout@v1
325+
- uses: actions/checkout@v1 # cannot be upgraded because Node.js Actions aren't supported in this container
326326
if: matrix.vector.jobname == 'linux32'
327327
- run: ci/install-docker-dependencies.sh
328328
- run: ci/run-build-and-tests.sh
@@ -331,13 +331,13 @@ jobs:
331331
run: ci/print-test-failures.sh
332332
- name: Upload failed tests' directories
333333
if: failure() && env.FAILED_TEST_ARTIFACTS != '' && matrix.vector.jobname != 'linux32'
334-
uses: actions/upload-artifact@v3
334+
uses: actions/upload-artifact@v4
335335
with:
336336
name: failed-tests-${{matrix.vector.jobname}}
337337
path: ${{env.FAILED_TEST_ARTIFACTS}}
338338
- name: Upload failed tests' directories
339339
if: failure() && env.FAILED_TEST_ARTIFACTS != '' && matrix.vector.jobname == 'linux32'
340-
uses: actions/upload-artifact@v1
340+
uses: actions/upload-artifact@v1 # cannot be upgraded because Node.js Actions aren't supported in this container
341341
with:
342342
name: failed-tests-${{matrix.vector.jobname}}
343343
path: ${{env.FAILED_TEST_ARTIFACTS}}
@@ -351,7 +351,7 @@ jobs:
351351
group: static-analysis-${{ github.ref }}
352352
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
353353
steps:
354-
- uses: actions/checkout@v3
354+
- uses: actions/checkout@v4
355355
- run: ci/install-dependencies.sh
356356
- run: ci/run-static-analysis.sh
357357
- run: ci/check-directional-formatting.bash
@@ -374,7 +374,7 @@ jobs:
374374
artifact: sparse-20.04
375375
- name: Install the current `sparse` package
376376
run: sudo dpkg -i sparse-20.04/sparse_*.deb
377-
- uses: actions/checkout@v3
377+
- uses: actions/checkout@v4
378378
- name: Install other dependencies
379379
run: ci/install-dependencies.sh
380380
- run: make sparse
@@ -389,6 +389,6 @@ jobs:
389389
jobname: Documentation
390390
runs-on: ubuntu-latest
391391
steps:
392-
- uses: actions/checkout@v3
392+
- uses: actions/checkout@v4
393393
- run: ci/install-dependencies.sh
394394
- run: ci/test-documentation.sh

Documentation/RelNotes/2.39.4.txt

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
Git v2.39.4 Release Notes
2+
=========================
3+
4+
This addresses the security issues CVE-2024-32002, CVE-2024-32004,
5+
CVE-2024-32020 and CVE-2024-32021.
6+
7+
This release also backports fixes necessary to let the CI builds pass
8+
successfully.
9+
10+
Fixes since v2.39.3
11+
-------------------
12+
13+
* CVE-2024-32002:
14+
15+
Recursive clones on case-insensitive filesystems that support symbolic
16+
links are susceptible to case confusion that can be exploited to
17+
execute just-cloned code during the clone operation.
18+
19+
* CVE-2024-32004:
20+
21+
Repositories can be configured to execute arbitrary code during local
22+
clones. To address this, the ownership checks introduced in v2.30.3
23+
are now extended to cover cloning local repositories.
24+
25+
* CVE-2024-32020:
26+
27+
Local clones may end up hardlinking files into the target repository's
28+
object database when source and target repository reside on the same
29+
disk. If the source repository is owned by a different user, then
30+
those hardlinked files may be rewritten at any point in time by the
31+
untrusted user.
32+
33+
* CVE-2024-32021:
34+
35+
When cloning a local source repository that contains symlinks via the
36+
filesystem, Git may create hardlinks to arbitrary user-readable files
37+
on the same filesystem as the target repository in the objects/
38+
directory.
39+
40+
* CVE-2024-32465:
41+
42+
It is supposed to be safe to clone untrusted repositories, even those
43+
unpacked from zip archives or tarballs originating from untrusted
44+
sources, but Git can be tricked to run arbitrary code as part of the
45+
clone.
46+
47+
* Defense-in-depth: submodule: require the submodule path to contain
48+
directories only.
49+
50+
* Defense-in-depth: clone: when symbolic links collide with directories, keep
51+
the latter.
52+
53+
* Defense-in-depth: clone: prevent hooks from running during a clone.
54+
55+
* Defense-in-depth: core.hooksPath: add some protection while cloning.
56+
57+
* Defense-in-depth: fsck: warn about symlink pointing inside a gitdir.
58+
59+
* Various fix-ups on HTTP tests.
60+
61+
* Test update.
62+
63+
* HTTP Header redaction code has been adjusted for a newer version of
64+
cURL library that shows its traces differently from earlier
65+
versions.
66+
67+
* Fix was added to work around a regression in libcURL 8.7.0 (which has
68+
already been fixed in their tip of the tree).
69+
70+
* Replace macos-12 used at GitHub CI with macos-13.
71+
72+
* ci(linux-asan/linux-ubsan): let's save some time
73+
74+
* Tests with LSan from time to time seem to emit harmless message that makes
75+
our tests unnecessarily flakey; we work it around by filtering the
76+
uninteresting output.
77+
78+
* Update GitHub Actions jobs to avoid warnings against using deprecated
79+
version of Node.js.

Documentation/fsck-msgids.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,18 @@
157157
`nullSha1`::
158158
(WARN) Tree contains entries pointing to a null sha1.
159159

160+
`symlinkPointsToGitDir`::
161+
(WARN) Symbolic link points inside a gitdir.
162+
163+
`symlinkTargetBlob`::
164+
(ERROR) A non-blob found instead of a symbolic link's target.
165+
166+
`symlinkTargetLength`::
167+
(WARN) Symbolic link target longer than maximum path length.
168+
169+
`symlinkTargetMissing`::
170+
(ERROR) Unable to read symbolic link target's blob.
171+
160172
`treeNotSorted`::
161173
(ERROR) A tree is not properly sorted.
162174

Documentation/git-upload-pack.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,37 @@ ENVIRONMENT
5555
admins may need to configure some transports to allow this
5656
variable to be passed. See the discussion in linkgit:git[1].
5757

58+
`GIT_NO_LAZY_FETCH`::
59+
When cloning or fetching from a partial repository (i.e., one
60+
itself cloned with `--filter`), the server-side `upload-pack`
61+
may need to fetch extra objects from its upstream in order to
62+
complete the request. By default, `upload-pack` will refuse to
63+
perform such a lazy fetch, because `git fetch` may run arbitrary
64+
commands specified in configuration and hooks of the source
65+
repository (and `upload-pack` tries to be safe to run even in
66+
untrusted `.git` directories).
67+
+
68+
This is implemented by having `upload-pack` internally set the
69+
`GIT_NO_LAZY_FETCH` variable to `1`. If you want to override it
70+
(because you are fetching from a partial clone, and you are sure
71+
you trust it), you can explicitly set `GIT_NO_LAZY_FETCH` to
72+
`0`.
73+
74+
SECURITY
75+
--------
76+
77+
Most Git commands should not be run in an untrusted `.git` directory
78+
(see the section `SECURITY` in linkgit:git[1]). `upload-pack` tries to
79+
avoid any dangerous configuration options or hooks from the repository
80+
it's serving, making it safe to clone an untrusted directory and run
81+
commands on the resulting clone.
82+
83+
For an extra level of safety, you may be able to run `upload-pack` as an
84+
alternate user. The details will be platform dependent, but on many
85+
systems you can run:
86+
87+
git clone --no-local --upload-pack='sudo -u nobody git-upload-pack' ...
88+
5889
SEE ALSO
5990
--------
6091
linkgit:gitnamespaces[7]

Documentation/git.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,37 @@ The index is also capable of storing multiple entries (called "stages")
10261026
for a given pathname. These stages are used to hold the various
10271027
unmerged version of a file when a merge is in progress.
10281028

1029+
SECURITY
1030+
--------
1031+
1032+
Some configuration options and hook files may cause Git to run arbitrary
1033+
shell commands. Because configuration and hooks are not copied using
1034+
`git clone`, it is generally safe to clone remote repositories with
1035+
untrusted content, inspect them with `git log`, and so on.
1036+
1037+
However, it is not safe to run Git commands in a `.git` directory (or
1038+
the working tree that surrounds it) when that `.git` directory itself
1039+
comes from an untrusted source. The commands in its config and hooks
1040+
are executed in the usual way.
1041+
1042+
By default, Git will refuse to run when the repository is owned by
1043+
someone other than the user running the command. See the entry for
1044+
`safe.directory` in linkgit:git-config[1]. While this can help protect
1045+
you in a multi-user environment, note that you can also acquire
1046+
untrusted repositories that are owned by you (for example, if you
1047+
extract a zip file or tarball from an untrusted source). In such cases,
1048+
you'd need to "sanitize" the untrusted repository first.
1049+
1050+
If you have an untrusted `.git` directory, you should first clone it
1051+
with `git clone --no-local` to obtain a clean copy. Git does restrict
1052+
the set of options and hooks that will be run by `upload-pack`, which
1053+
handles the server side of a clone or fetch, but beware that the
1054+
surface area for attack against `upload-pack` is large, so this does
1055+
carry some risk. The safest thing is to serve the repository as an
1056+
unprivileged user (either via linkgit:git-daemon[1], ssh, or using
1057+
other tools to change user ids). See the discussion in the `SECURITY`
1058+
section of linkgit:git-upload-pack[1].
1059+
10291060
FURTHER DOCUMENTATION
10301061
---------------------
10311062

INSTALL

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Issues of note:
139139
not need that functionality, use NO_CURL to build without
140140
it.
141141

142-
Git requires version "7.19.5" or later of "libcurl" to build
142+
Git requires version "7.21.3" or later of "libcurl" to build
143143
without NO_CURL. This version requirement may be bumped in
144144
the future.
145145

0 commit comments

Comments
 (0)