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

Re: [PATCH v2] Perform cheaper connectivity check when pack is used as medium

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Mar 2, 2012, 14:05 UTC
Message-ID
<CACsJy8D7JB9bzOvammGAx1rW04DEUCVzvfp-_Q1KtE9G00rZVQ@mail.gmail.com>
In-Reply-To
<7vwr73h6td.fsf@alter.siamese.dyndns.org>
2012/3/2 Junio C Hamano <gitster@pobox.com>:
Show 22 quoted lines
> Consider a case where you have this history
>
>
>    ---T       o---o---o
>
> where 'T' is the tip of your ref (everything reachable from it is known to
> be good), and 'o' are "isolated islands" commits that somehow exist in
> your repository but are not complete for whatever reason.
>
> The global history may look like this, where 'X' is the tip the other end
> advertised, and '.' are commits that are new to your repository.
>
>    ---T---.---o---o---o---.---X
>
> Upon seeing 'X' advertised and noticing 'T' is the current tip, you would
> ask for everything that is needed, i.e. "rev-list --objects T..X", to be
> sent to you.
>
> But the other end could send all the trees and commits for 'X' and '.' but
> nothing for 'o'.  You will end up with a corrupt history but the loosened
> "rev-list --objects T..X" you run after the object transfer will not catch
> it.  You need --verify-objects if you want to catch this mode of attack.

OK I think I get what you are trying to say. With "rev-list --objects T..X" we could check commit connectivity from X to T fine. But some trees in those 'o' commits are bad, but well-formed. As a result, rev-list goes well and we blindly accept bad trees/blobs. By checking for tree and blob integrity, we would catch these bad guys. Is that correct?

The bad islands may be injected from somewhere and cannot be trusted until they get connectivity with the main DAG.

Show 12 quoted lines
> Admittedly, in order to mount such an attack successfully, the attacker
> needs to know what "isolated islands" you happen to have in the receiving
> repository, which makes it much harder than a simpler attack (e.g. sending
> only X but nothing else) that would have worked before we introduced the
> connectivity check after object transfer.
>
> But we need to realize that the reasoning expressed in your log message
> "we received new objects by pack, so everything must validate fine" is not
> valid, and we are loosening ourselves to new attacks when we evaluate this
> patch.  This is because the completion of the history may be using objects
> that did not come from the other side (i.e. commits 'o' and all the trees
> necessary for them, but their blobs may be corrupt).

Not everything is valid, then. Objects from new packs are, existing ones may be guilty. If there is a way to mark new packs trusted, then we only need to validate the other objects, which should be the minority or even empty unless an attack is mounted.

-- 
Duy
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 23 in “Perform cheaper connectivity check when pack is used as medium”
  1. Perform cheaper connectivity check when pack is used as mediumNguyễn Thái Ngọc Duy, Feb 27, 2012
  2. Junio C HamanoFeb 27, 2012
  3. Perform cheaper connectivity check when pack is used as mediumNguyễn Thái Ngọc Duy, Feb 28, 2012
  4. Johannes SixtFeb 28, 2012
  5. Andreas EricssonFeb 28, 2012
  6. Nguyen Thai Ngoc DuyFeb 29, 2012
  7. Junio C HamanoMar 2, 2012
  8. Nguyen Thai Ngoc DuyMar 2, 2012
  9. Junio C HamanoMar 2, 2012
  10. Nguyen Thai Ngoc DuyMar 3, 2012
  11. Junio C HamanoMar 3, 2012
  12. Nguyen Thai Ngoc DuyMar 3, 2012
  13. Nguyen Thai Ngoc DuyMar 6, 2012
  14. Junio C HamanoMar 6, 2012
  15. {fetch,receive}-pack: skip sha-1 integrity test on objects from new packNguyễn Thái Ngọc Duy, Mar 14, 2012
  16. Junio C HamanoMar 14, 2012
  17. Junio C HamanoMar 15, 2012
  18. Junio C HamanoMar 15, 2012
  19. Nguyen Thai Ngoc DuyMar 16, 2012
  20. Junio C HamanoMar 16, 2012
  21. Nguyen Thai Ngoc DuyMar 16, 2012
  22. Nguyen Thai Ngoc DuyMar 16, 2012
  23. Junio C HamanoMar 16, 2012

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.