Avoid Git.Config.updateLocation adding "/.git" to the end of the repo
authorJoey Hess <joeyh@joeyh.name>
Tue, 14 Feb 2023 18:00:36 +0000 (14:00 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 14 Feb 2023 18:00:36 +0000 (14:00 -0400)
commitc1ef4a74812baacb21fea597861113e017f02509
treeebdd6d10fa39335ffbcd7e00ffe7dc51d565f77f
parent12b45d3b892ba58c5a75930a097f1469ec8fd466
Avoid Git.Config.updateLocation adding "/.git" to the end of the repo
path to a bare repo when git config is not allowed to list the configs
due to the CVE-2022-24765 fix.

That resulted in a confusing error message, and prevented the nice
message that explains how to mark the repo as safe to use.

Made isBare a tristate so that the case where core.bare is not returned can
be handled.

The handling in updateLocation is to check if the directory
contains config and objects and if so assume it's bare.
Note that if that heuristic is somehow wrong, it would construct a repo
that thinks it's bare but is not. That could cause follow-on problems,
but since git-annex then checks checkRepoConfigInaccessible, and skips
using the repo anyway, a wrong guess should not be a problem.

Sponsored-by: Luke Shumaker on Patreon
Assistant/MakeRepo.hs
CHANGELOG
Git/Config.hs
Git/Construct.hs
Git/CurrentRepo.hs
Remote/Git.hs
doc/bugs/bare_remote_safe_directory.mdwn