enable-tor: Fix breakage caused by git's fix for CVE-2022-24765

This relies on bfa451fc4e and is a bit of an
ugly hack.

Sponsored-by: Noam Kremen on Patreon
This commit is contained in:
Joey Hess 2022-09-26 14:48:58 -04:00
parent bfa451fc4e
commit ce65f11de0
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 13 additions and 1 deletions

View file

@ -38,6 +38,7 @@ git-annex (10.20220823) UNRELEASED; urgency=medium
* Run annex.freezecontent-command and annex.thawcontent-command * Run annex.freezecontent-command and annex.thawcontent-command
when on a crippled filesystem. when on a crippled filesystem.
Thanks, Reiko Asakura Thanks, Reiko Asakura
* enable-tor: Fix breakage caused by git's fix for CVE-2022-24765.
* Let GIT_DIR and --git-dir override git's protection against operating * Let GIT_DIR and --git-dir override git's protection against operating
in a repository owned by another user. in a repository owned by another user.

View file

@ -1,6 +1,6 @@
{- git-annex command {- git-annex command
- -
- Copyright 2016 Joey Hess <id@joeyh.name> - Copyright 2016-2022 Joey Hess <id@joeyh.name>
- -
- Licensed under the GNU AGPL version 3 or higher. - Licensed under the GNU AGPL version 3 or higher.
-} -}
@ -22,6 +22,8 @@ import P2P.IO
import qualified P2P.Protocol as P2P import qualified P2P.Protocol as P2P
import Utility.ThreadScheduler import Utility.ThreadScheduler
import RemoteDaemon.Transport.Tor import RemoteDaemon.Transport.Tor
import Git.Types
import Config
import Control.Concurrent.Async import Control.Concurrent.Async
import qualified Network.Socket as S import qualified Network.Socket as S
@ -70,6 +72,15 @@ start _os = do
#endif #endif
where where
go userid = do go userid = do
-- Usually git will refuse to read local configs of a git
-- repo belonging to another user. But in this case, the
-- user wants this command, run as root, to operate on
-- their repo. Behave as if --git-dir had been used to
-- specify that the git directory is intended to be used.
Annex.adjustGitRepo $ \r -> return $ r
{ gitDirSpecifiedExplicitly = True }
reloadConfig
uuid <- getUUID uuid <- getUUID
when (uuid == NoUUID) $ when (uuid == NoUUID) $
giveup "This can only be run in a git-annex repository." giveup "This can only be run in a git-annex repository."