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

Re: [PATCH 8/8] gpg-interface: handle alternative signature types

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
May 7, 2018, 23:06 UTC
Message-ID
<20180507230650.GH953644@genre.crustytoothpaste.net>
In-Reply-To
<20180507094459.GA3412@sigill.intra.peff.net>
On Mon, May 07, 2018 at 05:45:00AM -0400, Jeff King wrote:
Show 37 quoted lines
> Isn't that basically what this patch is, though? Or at least a step in
> that direction? For generic signing support, you need:
> 
>   1. A way to tell Git to recognize that a signature exists, and what
>      type it is.
> 
>   2. A way to tell Git how to invoke the signing tool.
> 
> Let me discuss (2) first.  In your git-sign-* world, then (2) requires
> us to define a set interface to those helpers, including which action to
> perform, which key to use, etc. And then the logic is inside the helper
> to translate that to the tool's interface.
> 
> The direction I anticipated for this patch was more like:
> 
>  - for now, we just piggy-back on gpg's interface for interacting with
>    sub-programs. That makes gpgsm Just Work, and it means that you can
>    plug in any other tool by writing a wrapper which converts from gpg
>    options to the tool's interface. I.e., gpg's "-bsau" becomes the
>    lingua franca, rather than us inventing a new one.
> 
>  - the config schema leaves room for adding new properties to each tool.
>    So eventually we could support other option microformats by adding
>    signingtool.foo.interface = "signify" or whatever.
> 
>    That still leaves room if we want to design our own helper interface.
>    One thing we could do that this patch doesn't is require the user to
>    explicitly ask for "interface = gpg" (and set it by default for the
>    gpg tool stanza). And then leave it as an error if you have a tool
>    config that doesn't specify its interface type, which leaves room for
>    us later to make that default our generic interface.
> 
> Getting back to (1), how do we tell Git to recognize a signature? I
> think we have to use config here, since it would not know to invoke a
> helper without recognizing the type (and we certainly do not want to
> speculatively invoke each helper saying "do you understand this?" for
> efficiency reasons).

I think my main objection to this series is that it is generic in a way that isn't necessarily useful. We know there are essentially only two formats of PEM-style signatures: OpenPGP and CMS[0]. Even if there are more, they aren't intrinsically useful, because our codebase can only handle GnuPG-style tools, and those are the only formats GnuPG-style tools really support (although, as you point out, other tools could mimic the interface).

I think if we aren't going to implement some sort of interface that's generically useful for all signing tools, it would be better to simply say that we support gpg and gpgsm and have signingtool.gpg.program and signingtool.gpgsm.program and hard-code the logic for those two formats. That way we don't have a generic interface that's really only useful for PEM-style tools, when we know it likely won't be useful for other tools as well. We can add a more generic interface when we have more varied tools to support and we know more about what the requirements will be.

This doesn't address Junio's concern about whether adding CMS support is the right direction to go. I personally think OpenPGP is the right direction for most open-source projects, but I know some companies want to use CMS internally and I'm not intrinsically opposed to that[1]. That decision is ultimately up to Junio, though.

[0] I'm ignoring the original PEM, which specifies MD2 and MD5, algorithms that nobody should be using these days. [1] I would welcome, though, if one could configure only one type of signature verification by, say, setting the signing program to /bin/false in the config.

-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204
Previous: Junio C HamanoNext: Jeff King
Message 30 of 46 in “gpg-interface: Multiple signing tools”
  1. 0/8 gpg-interface: Multiple signing toolsBen Toews, Apr 9, 2018
  2. 1/8 gpg-interface: handle bool user.signingkeyBen Toews, Apr 9, 2018
  3. Eric SunshineApr 9, 2018
  4. Jeff KingApr 10, 2018
  5. 3/8 gpg-interface: use size_t for signature buffer sizeBen Toews, Apr 9, 2018
  6. 2/8 gpg-interface: modernize function declarationsBen Toews, Apr 9, 2018
  7. 4/8 gpg-interface: fix const-correctness of "eol" pointerBen Toews, Apr 9, 2018
  8. 5/8 gpg-interface: extract gpg line matching helperBen Toews, Apr 9, 2018
  9. 7/8 gpg-interface: prepare for parsing arbitrary PEM blocksBen Toews, Apr 9, 2018
  10. 6/8 gpg-interface: find the last gpg signature lineBen Toews, Apr 9, 2018
  11. Eric SunshineApr 9, 2018
  12. Junio C HamanoApr 10, 2018
  13. Ben ToewsApr 10, 2018
  14. Junio C HamanoApr 10, 2018
  15. Junio C HamanoApr 10, 2018
  16. Ben ToewsApr 11, 2018
  17. 8/8 gpg-interface: handle alternative signature typesBen Toews, Apr 9, 2018
  18. Stefan BellerApr 9, 2018
  19. Eric SunshineApr 10, 2018
  20. Ben ToewsApr 10, 2018
  21. brian m. carlsonApr 14, 2018
  22. Junio C HamanoApr 16, 2018
  23. brian m. carlsonApr 17, 2018
  24. Junio C HamanoApr 17, 2018
  25. Ben ToewsApr 17, 2018
  26. Taylor BlauApr 17, 2018
  27. Ben ToewsMay 3, 2018
  28. Jeff KingMay 7, 2018
  29. Junio C HamanoMay 7, 2018
  30. brian m. carlsonMay 7, 2018
  31. Jeff KingMay 8, 2018
  32. brian m. carlsonMay 8, 2018
  33. Jeff KingMay 9, 2018
  34. Junio C HamanoApr 10, 2018
  35. Ben ToewsApr 10, 2018
  36. SZEDER GáborApr 11, 2018
  37. 0/9 gpg-interface: Multiple signing toolsBen Toews, Apr 13, 2018
  38. 2/9 gpg-interface: handle bool user.signingkeyBen Toews, Apr 13, 2018
  39. 3/9 gpg-interface: modernize function declarationsBen Toews, Apr 13, 2018
  40. 1/9 t7004: fix mistaken tag nameBen Toews, Apr 13, 2018
  41. 8/9 gpg-interface: prepare for parsing arbitrary PEM blocksBen Toews, Apr 13, 2018
  42. 4/9 gpg-interface: use size_t for signature buffer sizeBen Toews, Apr 13, 2018
  43. 5/9 gpg-interface: fix const-correctness of "eol" pointerBen Toews, Apr 13, 2018
  44. 6/9 gpg-interface: extract gpg line matching helperBen Toews, Apr 13, 2018
  45. 7/9 gpg-interface: find the last gpg signature lineBen Toews, Apr 13, 2018
  46. 9/9 gpg-interface: handle alternative signature typesBen Toews, Apr 13, 2018

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.