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

Re: git log -p unexpected behaviour - security risk?

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 21, 2013, 18:42 UTC
Message-ID
<7vli8bu3ne.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20130421160939.GA29341@elie.Belkin>
Jonathan Nieder <jrnieder@gmail.com> writes:
> The thing is, I'm not convinced this is a bad default.  "Shows no diff
> at all for merges" is easy for a person to understand.  It is much
> easier to understand its limitations than -c and --cc.

Making "log -p -m" a default before -c/--cc was introduced would have been the stupidest thing to do, as it would make the command mostly useless. Nobody would want to see repetitious output from a merge that he would eventually get when the traversal drills down to individual commits on the merged side branch.

When I added -c/--cc, I contemplated making -p imply --cc, but decided against it primarily because it is a change in traditional behaviour, and it is easy for users to say --cc instead of -p from the command line.

On the other hand, "show" was a newer command and it was easy to turn its default to --cc without having to worry too much about existing users.

> For that
> reason, it is a much *better* default for security than --cc or -c
> (even though I believe one of the latter would be a better default for
> convenience).

Yes. I do not fundamentally oppose to the idea of "log -p" to imply "log --cc" when "-m" is not given ("log -p -m" is specifically declining the combined diff simplification). It may be a usability improvement.

But "--cc/-c" does not have anything to do with Tapsell's "security worries". The only real audit he can do is with "log -m -p", possibly with --first-parent (only if he trusts his first-parent history).

The "recreate mechanical merge and compare recorded merge against it" mode may highlight a malicious merger, but it will not show a cleanly merged hunk of malicious code in the merge, so it cannot be used with --first-parent when used as a "security audit tool". Tapsell still needs to drill down to the merged side branch that introduced the malicious change that merged cleanly with "-p".

Previous: Jonathan NiederNext: John Szakmeister
Message 10 of 22 in “git log -p unexpected behaviour - security risk?”
  1. John TapsellApr 11, 2013
  2. Tay Ray ChuanApr 11, 2013
  3. Simon RuderichApr 20, 2013
  4. Junio C HamanoApr 21, 2013
  5. John TapsellApr 21, 2013
  6. Jonathan NiederApr 21, 2013
  7. John TapsellApr 21, 2013
  8. Thomas RastApr 21, 2013
  9. Jonathan NiederApr 21, 2013
  10. Junio C HamanoApr 21, 2013
  11. John SzakmeisterApr 30, 2013
  12. Junio C HamanoApr 30, 2013
  13. John SzakmeisterApr 30, 2013
  14. Matthieu MoyApr 30, 2013
  15. John SzakmeisterApr 30, 2013
  16. John TapsellApr 30, 2013
  17. Junio C HamanoApr 30, 2013
  18. John TapsellApr 30, 2013
  19. Junio C HamanoApr 30, 2013
  20. John TapsellMay 1, 2013
  21. shawn wilsonApr 30, 2013
  22. Junio C HamanoApr 21, 2013

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.