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

Re: Git clone reads safe.directory differently?

From
WPW. Michael Petullo <mike@flyn.org>
Date
Aug 5, 2024, 15:34 UTC
Message-ID
<ZrDxHPh-daYPxzT2@imp.flyn.org>
In-Reply-To
<20240805094709.GA632664@coredump.intra.peff.net>

Thank you---from a somewhat sophisticated Git user, but not a Git developer---for all of the discussion that followed my initial inquiry. I thought I would follow up with some comments that follow from my reading of the responses and the SECURITY sections of various man pages.

> [From Jeff:] So there's an open question on the degree to which
> running upload-pack is actually dangerous. It's not _supposed_ to be,
> but the ownership check is a defense-in-depth approach to safety.

The discussion here is partially an attempt to better understand some of the internal workings and guarantees to determine whether or not the protections applied in some cases are spurious, right?

Show 5 quoted lines
> [From Brian:] 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

The remarks above closely resemble the use cases that prompted my initial inquiry. It would help a great deal if these worked, and also if "--no-local --no-hardlinks" remains the default for the SSH variant. Is it fair to conclude that these not working represent a bug?

> [From Brian:] The git(1) manual page also says this:
>   [...] but beware that the surface area for attack against
>   `upload-pack` is large

Does the use of attack surface here mean the general idea of "the volume of lines of code in upload-pack is large and thus upload-pack likely contains bugs that might represent vulnerabilities", or is there something specific about upload-pack that should raise concern?

I do have a related question on the SSH/push side. Let us imagine a host that has user accounts bearing git-shell as their shell. Thus these users can only interact with the host (and the repositories therein) using Git. Further imagine a trusted agent on the host creates these repositories and any hooks therein. Can a special account, with permission to access all of the repositories, safely clone and push other users' repositories? Or, could a user introduce a dangerous hook or configuration option to their remote repository using only Git by way of git-shell?

Thank you again, especially Jeff, who provided me with some practical workarounds early in this thread.

-- 
Mike

:wq
Previous: Jeff KingNext: Junio C Hamano
Message 18 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.