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

Re: [PATCH 3/3] verify-commit: scriptable commit signature verification

From
Jeff King <peff@peff.net>
Date
Jun 13, 2014, 11:09 UTC
Message-ID
<20140613110901.GB14066@sigill.intra.peff.net>
In-Reply-To
<539ACA8A.90108@drmicha.warpmail.net>
On Fri, Jun 13, 2014 at 11:55:22AM +0200, Michael J Gruber wrote:
> > Did you give any thought to just having a "git verify" command, instead
> > of separate tag/verify commands?
> 
> Yes. (mathematician's answer)
Cute.
> You know not only the outcome but also why I refrained from doing so:
> compatibility. We would need to deprecate verify-tag.

Yes, we'd certainly leave verify-tag in place for compatibility. I don't think that makes "git verify" a bad idea necessarily, if it is a better interface. But...

> But there is also a more subtle reason: If you want to verify a signed
> commit, you want to be sure that it actually is a commit. "verify" could
> easily branch code paths based on the object type, but I'm not sure that
> is desirable, at least not by default.

Yes, I wasn't sure about that part. I think it really depends on what people want to use it for. I was thinking more of a porcelain, anyway, to just check whatever signatures are available. But I don't really sign my commits right now anyway, so I'm somewhat guessing.

Even if we decide to do something like that, I suppose having verify-commit isn't the end of the world. It could just remain the plumbing interface, as verify-tag would. So I don't think my half-formed thoughts are any reason to block your series.

Show 8 quoted lines
> That is a general issue with verifying signatures: it can be automated
> only if you employ a strict trust model and a very limited keyring.
> "valid signature" means only as much as the signatures that your gpg
> accepts can be really trusted.
> 
> Comparing uid's really buys you nothing in the sense that everyone can
> have a key with uid "Jeff King <peff@peff.net> signed by some other
> keys.

Sort of. The crypto proves that the commit was signed by a particular key, and then there are two mappings:

  1. What is the identity associated with that key?
  2. Is that identity somebody who "should" have signed the commit?

We assume that GPG takes care of the first one with the web of trust. Even if you have the key and can check the signature, it will still complain about an untrusted uid (and we reflect that with 'U' in the gpg status). There is no point in looking at step 2 if step 1 did not check out.

For the second one, I think it really depends on the project workflow, and you may even want multiple policies within a project (e.g., perhaps only some uids can merge to master). But one obvious check we can make is "does the identity in the commit data match one of the uids?". True, you don't _need_ that; you can always just use "%GS", and throw away the committer and author headers. But we show those names in lots of output. You could, for example, "verify" that each commit's author id matches its gpg signature, and then use the regular tools to do further work (e.g., running "git blame"), and be confident that the author you see matches the signature.

This should definitely be optional. Even something as simple as "author id matches the gpg key" would not always work (for example, in git.git we pick patches from the list, which means only Junio can sign the objects, but he is not the author). But just because it is optional does not mean it would not be a useful tool for some workflows.

Show 6 quoted lines
> On the other hand, it's perfectly OK to use different uids for git
> commits and signatures. The e-mail address I use for the git list and
> commits, for example, is clearly a "plus address", which helps me
> organize things; my personal key has the primary address as uid.
> 
> I really think all this is up to local policies for individual use cases.

Very much agreed. My suggestion was more about providing tools for people to build those policies.

I realize this isn't really your itch to scratch. It's just that when I see a description like "verify a commit", I wonder what exactly "verify" means.

-Peff
Previous: Michael J GruberNext: Junio C Hamano
Message 11 of 75 in “verify-commit: verify commit signatures”
  1. 0/3 verify-commit: verify commit signaturesMichael J Gruber, Jun 6, 2014
  2. 1/3 pretty: free the gpg status bufMichael J Gruber, Jun 6, 2014
  3. 2/3 gpg-interface: provide access to the payloadMichael J Gruber, Jun 6, 2014
  4. Jeff KingJun 13, 2014
  5. Michael J GruberJun 13, 2014
  6. Jeff KingJun 13, 2014
  7. 3/3 verify-commit: scriptable commit signature verificationMichael J Gruber, Jun 6, 2014
  8. Michael J GruberJun 11, 2014
  9. Jeff KingJun 13, 2014
  10. Michael J GruberJun 13, 2014
  11. Jeff KingJun 13, 2014
  12. Junio C HamanoJun 13, 2014
  13. Michael J GruberJun 16, 2014
  14. Jeff KingJun 16, 2014
  15. Junio C HamanoJun 16, 2014
  16. Jeff KingJun 16, 2014
  17. Michael J GruberJun 27, 2014
  18. Michael J GruberJun 27, 2014
  19. Michael J GruberJun 27, 2014
  20. log: correctly identify mergetag signature verification statusMichael J Gruber, Jun 27, 2014
  21. Jeff KingJun 28, 2014
  22. Junio C HamanoJul 10, 2014
  23. Michael J GruberJun 27, 2014
  24. Junio C HamanoJun 27, 2014
  25. Junio C HamanoJun 27, 2014
  26. Jeff KingJun 28, 2014
  27. Junio C HamanoJun 30, 2014
  28. 0/6 verify-commit: verify commit signaturesMichael J Gruber, Jun 13, 2014
  29. 0/5 verify-commit: verify commit signaturesMichael J Gruber, Jun 23, 2014
  30. Jeff KingJun 23, 2014
  31. Junio C HamanoJun 23, 2014
  32. Jeff KingJun 23, 2014
  33. Junio C HamanoJun 23, 2014
  34. 0/4 verify-commit: verify commit signaturesMichael J Gruber, Jun 27, 2014
  35. Junio C HamanoJun 27, 2014
  36. Jeff KingJun 28, 2014
  37. Jeff KingJun 28, 2014
  38. 1/4 gpg-interface: provide clear helper for struct signature_checkMichael J Gruber, Jun 27, 2014
  39. 2/4 gpg-interface: provide access to the payloadMichael J Gruber, Jun 27, 2014
  40. 3/4 verify-commit: scriptable commit signature verificationMichael J Gruber, Jun 27, 2014
  41. 4/4 t7510: test verify-commitMichael J Gruber, Jun 27, 2014
  42. Junio C HamanoJun 27, 2014
  43. Michael J GruberJun 27, 2014
  44. 1/5 gpg-interface: provide clear helper for struct signature_checkMichael J Gruber, Jun 23, 2014
  45. 2/5 gpg-interface: provide access to the payloadMichael J Gruber, Jun 23, 2014
  46. 3/5 verify-commit: scriptable commit signature verificationMichael J Gruber, Jun 23, 2014
  47. 4/5 t7510: exit for loop with test resultMichael J Gruber, Jun 23, 2014
  48. 5/5 t7510: test verify-commitMichael J Gruber, Jun 23, 2014
  49. Junio C HamanoJun 23, 2014
  50. 1/6 pretty: free the gpg status bufMichael J Gruber, Jun 13, 2014
  51. Jeff KingJun 13, 2014
  52. 2/6 gpg-interface: provide access to the payloadMichael J Gruber, Jun 13, 2014
  53. 3/6 verify-commit: scriptable commit signature verificationMichael J Gruber, Jun 13, 2014
  54. Jeff KingJun 13, 2014
  55. Michael J GruberJun 13, 2014
  56. Jeff KingJun 13, 2014
  57. Michael J GruberJun 13, 2014
  58. 4/6 t7510: exit for loop with test resultMichael J Gruber, Jun 13, 2014
  59. Jeff KingJun 13, 2014
  60. Michael J GruberJun 13, 2014
  61. Michael J GruberJun 13, 2014
  62. Michael J GruberJun 13, 2014
  63. Jeff KingJun 13, 2014
  64. Johannes SixtJun 13, 2014
  65. Michael J GruberJun 13, 2014
  66. Johannes SixtJun 13, 2014
  67. Jeff KingJun 13, 2014
  68. Michael J GruberJun 13, 2014
  69. Johannes SixtJun 13, 2014
  70. Junio C HamanoJun 13, 2014
  71. 5/6 t7510: test verify-commitMichael J Gruber, Jun 13, 2014
  72. Jeff KingJun 13, 2014
  73. Michael J GruberJun 13, 2014
  74. Junio C HamanoJun 13, 2014
  75. 6/6 gpg-interface: provide clear helper for struct signature_checkMichael J Gruber, Jun 13, 2014

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.