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

Re: Commit SHA1 == SHA1 checksum?

From
Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Date
Feb 7, 2022, 13:15 UTC
Message-ID
<20220207131520.cqkdtmceddqquwlg@meerkat.local>
In-Reply-To
<734DE4FA-E4B1-43CB-89EE-3C200FA21F4F@llnl.gov>
On Mon, Feb 07, 2022 at 08:15:58AM +0000, Gamblin, Todd wrote:
> In our case, the initial trust doesn’t come from a PGP signature — it comes
> (at least for now) from having cloned the package repository from GitHub.

Not really the case, if you're relying on a particular commit hash, as you state. Once you specify a target hash, you don't really have to care where the repository came from -- the hash is either going to be there and be valid, or it's not going to be there.

It only matters where the person who picked that hash cloned the repository from and what steps they made to verify that it is a legitimate commit. If "I cloned this repository from github" is sufficient for your needs, then that's fine. The alternative is to use PGP verification, but in either case once you pick a hash to use, you can rely on git to do all the rest.

> That said, I guess I do still have one more question — how soon will git
> notice that a given repo is corrupted/tampered with (insofar as sha1 can do
> that)?  On checkout?

Yes. I've asked this question before as well: https://lore.kernel.org/git/20190829141010.GD1797@sigill.intra.peff.net/

The relevant bit:
    Then yes, there is no need to fsck. When the objects were received on
    the server side (by push) and then again when you got them from the
    server (by clone), their sha1s were recomputed from scratch, not
    trusting the sender at all in either case.
-K
Previous: Gamblin, ToddNext: Gamblin, Todd
Message 10 of 19 in “Commit SHA1 == SHA1 checksum?”
  1. Gamblin, ToddFeb 5, 2022
  2. Philip OakleyFeb 6, 2022
  3. Gamblin, ToddFeb 6, 2022
  4. Johannes SixtFeb 6, 2022
  5. Junio C HamanoFeb 6, 2022
  6. Philip OakleyFeb 6, 2022
  7. Junio C HamanoFeb 6, 2022
  8. Philip OakleyFeb 6, 2022
  9. Gamblin, ToddFeb 7, 2022
  10. Konstantin RyabitsevFeb 7, 2022
  11. Gamblin, ToddFeb 7, 2022
  12. Konstantin RyabitsevFeb 7, 2022
  13. Junio C HamanoFeb 7, 2022
  14. Konstantin RyabitsevFeb 7, 2022
  15. Gamblin, ToddFeb 7, 2022
  16. Konstantin RyabitsevFeb 7, 2022
  17. Gamblin, ToddFeb 8, 2022
  18. Junio C HamanoFeb 7, 2022
  19. Konstantin RyabitsevFeb 7, 2022

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.