fsck: warn about symlink pointing inside a gitdir
commita33fea0886cfa016d313d2bd66bdd08615bffbc9
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Wed, 10 Apr 2024 16:01:13 +0000 (10 18:01 +0200)
committerJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 19 Apr 2024 10:38:25 +0000 (19 12:38 +0200)
treeb8c29bc2c4fdf4a1bcf34a1acdde2e429168724c
parent20f3588efc6cbcae5bbaabf65ee12df87b51a9ea
fsck: warn about symlink pointing inside a gitdir

In the wake of fixing a vulnerability where `git clone` mistakenly
followed a symbolic link that it had just written while checking out
files, writing into a gitdir, let's add some defense-in-depth by
teaching `git fsck` to report symbolic links stored in its trees that
point inside `.git/`.

Even though the Git project never made any promises about the exact
shape of the `.git/` directory's contents, there are likely repositories
out there containing symbolic links that point inside the gitdir. For
that reason, let's only report these as warnings, not as errors.
Security-conscious users are encouraged to configure
`fsck.symlinkPointsToGitDir = error`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Documentation/fsck-msgids.txt
fsck.c
fsck.h
t/t1450-fsck.sh