git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git clone reads safe.directory differently?

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Jul 30, 2024, 22:28 UTC
Message-ID
<Zqlo-i8uCb1Yr4Jm@tapette.crustytoothpaste.net>
In-Reply-To
<ZqjQi6i2kiY4gcc1@imp.flyn.org>
On 2024-07-30 at 11:37:47, W. Michael Petullo wrote:
> Perhaps a compromise would be to tie safe.directory to the type
> of source directory given to clone. Would a remote URL be enough to
> turn off the safe.directory checks on a clone, similar to the effect of
> a remote URL on --local/--no-local?

I think if we're using --no-local (that is, if we're using upload-pack instead of creating symlinks), then we should not complain about the repository ownership. It's supposed to always be safe to clone or fetch from an untrusted repository, and we shouldn't complain about that.

Both of these commands should work correctly and do not, and that's a bug (assuming tr1 is owned by a different user):

  git clone --no-local --no-hardlinks $PWD/tr1 tr2
  git clone --no-local --no-hardlinks ssh://localhost$PWD/tr1 tr2

git-upload-pack should not complain about safe.directory at all. If it's not secure to clone or fetch from an untrusted repository with git-upload-pack, then we have a bigger security problem that needs to be addressed.

-- 
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA
Previous: W. Michael PetulloNext: Junio C Hamano
Message 6 of 21 in “Git clone reads safe.directory differently?”
  1. W. Michael PetulloJul 27, 2024
  2. Jeff KingJul 27, 2024
  3. W. Michael PetulloJul 28, 2024
  4. Jeff KingJul 28, 2024
  5. W. Michael PetulloJul 30, 2024
  6. brian m. carlsonJul 30, 2024
  7. Junio C HamanoJul 30, 2024
  8. Junio C HamanoJul 30, 2024
  9. brian m. carlsonJul 30, 2024
  10. Jeff KingJul 31, 2024
  11. Junio C HamanoJul 31, 2024
  12. Junio C HamanoJul 31, 2024
  13. Jeff KingAug 1, 2024
  14. Junio C HamanoAug 1, 2024
  15. brian m. carlsonAug 1, 2024
  16. Junio C HamanoAug 1, 2024
  17. Jeff KingAug 5, 2024
  18. W. Michael PetulloAug 5, 2024
  19. Junio C HamanoAug 5, 2024
  20. Jeff KingAug 1, 2024
  21. Jeff KingJul 31, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.