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

Re: [PATCH 1/1] signature-format.txt: add space to fix gpgsig continuation line

From
Jeff King <peff@peff.net>
Date
Oct 11, 2021, 16:41 UTC
Message-ID
<YWRpPw4eTwTmgVvC@coredump.intra.peff.net>
In-Reply-To
<20211009163338.2175170-1-rlb@defaultvalue.org>
On Sat, Oct 09, 2021 at 11:33:38AM -0500, Rob Browning wrote:
> Add a space to the blank line after the version header in the example
> gpgsig commit header.

Thanks, this is a good catch. The space is important for the header continuation.

Show 13 quoted lines
> diff --git a/Documentation/technical/signature-format.txt b/Documentation/technical/signature-format.txt
> index 2c9406a56a..6acc0b1247 100644
> --- a/Documentation/technical/signature-format.txt
> +++ b/Documentation/technical/signature-format.txt
> @@ -78,7 +78,7 @@ author A U Thor <author@example.com> 1465981137 +0000
>  committer C O Mitter <committer@example.com> 1465981137 +0000
>  gpgsig -----BEGIN PGP SIGNATURE-----
>   Version: GnuPG v1
> -
> + 
>   iQEcBAABAgAGBQJXYRjRAAoJEGEJLoW3InGJ3IwIAIY4SA6GxY3BjL60YyvsJPh/
>   HRCJwH+w7wt3Yc/9/bW2F+gF72kdHOOs2jfv+OZhq0q4OAN6fvVSczISY/82LpS7
>   DVdMQj2/YcHDT4xrDNBnXnviDO9G7am/9OE77kEbXrp7QPxvhjkicHNwy2rEflAA

The patch is quite subtle to read, of course. :) But more importantly, it is subtle for somebody reading the documentation to notice. Perhaps it's worth calling it out explicitly? E.g., squashing in something like:

diff --git a/Documentation/technical/signature-format.txt b/Documentation/technical/signature-format.txt
index 6acc0b1247..f418431050 100644
--- a/Documentation/technical/signature-format.txt
+++ b/Documentation/technical/signature-format.txt
@@ -68,7 +68,9 @@ signed tag message body
 - created by: `git commit -S`
 - payload: commit object
 - embedding: header entry `gpgsig`
-  (content is preceded by a space)
+  (content is preceded by a space; note that this includes the
+   "empty" line between the GnuPG header and signature, which
+   consists of a single space).
 - example: commit with subject `signed commit`
 
 ----

>  While investigating this (while parsing commit objects) I also
>  noticed a commit in a repo that had a blank continuation line (" \n")
>  after the "END PGP SIGNATURE" line.
> 
>  Presuming that's valid, I suppose we could consider detailing any
>  additional specifications, i.e. what kind of trailing content a
>  parser should expect/ignore, etc.

It is valid. It looks like GitHub's signed-merges may do this. From our
perspective, we are not really defining what is valid content or not. We
take everything in the gpgsig header (including multiple lines connected
by space-continuation), and feed it to gpg. So if gpg is happy with it,
we are happy with it.

Thinking with a security hat on, it's possible this could lead to
confusion (say, if I include multiple signatures but some tools check
one and some the other). But I'd be hesitant to start adding
restrictions without even a plausible attack scenario.

-Peff
Previous: Rob BrowningNext: Junio C Hamano
Message 2 of 11 in “signature-format.txt: add space to fix gpgsig continuation line”
  1. 1/1 signature-format.txt: add space to fix gpgsig continuation lineRob Browning, Oct 9, 2021
  2. Jeff KingOct 11, 2021
  3. Junio C HamanoOct 11, 2021
  4. Jeff KingOct 12, 2021
  5. Junio C HamanoOct 12, 2021
  6. signature-format.txt: explain and illustrate multi-line headersJunio C Hamano, Oct 13, 2021
  7. Rob BrowningOct 14, 2021
  8. Junio C HamanoOct 14, 2021
  9. Rob BrowningOct 15, 2021
  10. Junio C HamanoOct 15, 2021
  11. Rob BrowningOct 15, 2021

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.