Skip to content

Commit 90695bb

Browse files
Uwe Kleine-Königgitster
authored andcommitted
gpg-interface: signatures by expired keys are fine
If a signature is made with a valid key and that key later expires, the signature should still be considered good. GnuPG emits in this case something like: [GNUPG:] NEWSIG gpg: Signature made Wed 26 Nov 2014 05:56:50 AM CET gpg: using RSA key FE3958F9067BC667 [GNUPG:] KEYEXPIRED 1478449622 [GNUPG:] KEY_CONSIDERED D783920D6D4F0C06AA4C25F3FE3958F9067BC667 0 [GNUPG:] KEYEXPIRED 1478449622 [GNUPG:] SIG_ID 8tAN3Fx6XB2NAoH5U8neoguQ9MI 2014-11-26 1416977810 [GNUPG:] EXPKEYSIG FE3958F9067BC667 Jason Cooper <jason@lakedaemon.net> gpg: Good signature from "Jason Cooper <jason@lakedaemon.net>" [expired] [GNUPG:] VALIDSIG D783920D6D4F0C06AA4C25F3FE3958F9067BC667 2014-11-26 1416977810 0 4 0 1 2 00 D783920D6D4F0C06AA4C25F3FE3958F9067BC667 gpg: Note: This key has expired! D783920D6D4F0C06AA4C25F3FE3958F9067BC667 (signature and signed data in this example is taken from Linux commit 756f80c). So GnuPG is relaxed and the fact that the key is expired is only worth a "Note" which is weaker than e.g. gpg: WARNING: The key's User ID is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner. which git still considers ok. So stop coloring the signature by an expired key red and handle it like any other good signature. Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent b2826b5 commit 90695bb

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

gpg-interface.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,8 @@ static int verify_gpg_signed_buffer(struct signature_check *sigc,
382382

383383
delete_tempfile(&temp);
384384

385-
ret |= !strstr(gpg_stdout.buf, "\n[GNUPG:] GOODSIG ");
385+
ret |= !strstr(gpg_stdout.buf, "\n[GNUPG:] GOODSIG ") &&
386+
!strstr(gpg_stdout.buf, "\n[GNUPG:] EXPKEYSIG ");
386387
sigc->output = strbuf_detach(&gpg_stderr, NULL);
387388
sigc->gpg_status = strbuf_detach(&gpg_stdout, NULL);
388389

@@ -680,7 +681,7 @@ int check_signature(struct signature_check *sigc,
680681
if (status && !sigc->output)
681682
return !!status;
682683

683-
status |= sigc->result != 'G';
684+
status |= sigc->result != 'G' && sigc->result != 'Y';
684685
status |= sigc->trust_level < configured_min_trust_level;
685686

686687
return !!status;

0 commit comments

Comments
 (0)