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

Re: Can Git repos be hacked or otherwise manipulated?

From
Jeff King <peff@peff.net>
Date
Jan 15, 2020, 18:01 UTC
Message-ID
<20200115180140.GA4081287@coredump.intra.peff.net>
In-Reply-To
<bvMqhQOr4uENl8j2zcFOY0ogJmUqTRofCGyPlPc_xaXQXSP5ds9lgdglXkjTZng9U5WSpo-Uc2_SzCTdpAvLTeruT-tW3GTDkWj9dfLznuM=@protonmail.com>
On Wed, Jan 15, 2020 at 03:18:34AM +0000, 1234dev wrote:
> To work around this problem, should we instead host this repo on a
> public service? If so which one would you recommend?
Oops, I forgot to mention the actual solution. :)

Generally it is safe to clone _from_ an untrusted repo, even if it's on a local filesystem. So untarring the repo and running:

  git clone evil.git safe
  cd safe
  git log
should make it OK to run Git commands inside the "safe" directory.

Jonathan Nieder also mentioned using a bundle file, which may be even simpler, as it skips the part where you have to deal with tar. :)

Run:
  git bundle create foo.bundle --all
on the sending side, and then you can just:
  git clone foo.bundle safe
on the receiving side.
-Peff
Previous: Jonathan NiederNext: Junio C Hamano
Message 5 of 6 in “Can Git repos be hacked or otherwise manipulated?”
  1. 1234devJan 14, 2020
  2. Jeff KingJan 14, 2020
  3. 1234devJan 15, 2020
  4. Jonathan NiederJan 15, 2020
  5. Jeff KingJan 15, 2020
  6. Junio C HamanoJan 16, 2020

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.