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

Re: [PATCH 3/6] ssh signing: verify-commit/check_signature with commit date

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Oct 22, 2021, 17:37 UTC
Message-ID
<211022.86ee8dj6uv.gmgdl@evledraar.gmail.com>
In-Reply-To
<20211022150949.1754477-4-fs@gigacodes.de>
On Fri, Oct 22 2021, Fabian Stelzer wrote:
[Just nits]
> +	if (payload_timestamp) {
> +		strbuf_addf(&verify_time, "-Overify-time=%s",
> +			    show_date(payload_timestamp, 0, &verify_date_mode));
> +	}
No braces needed.
Show 8 quoted lines
> @@ -482,6 +495,7 @@ static int verify_ssh_signed_buffer(struct signature_check *sigc,
>  		error(_("ssh-keygen -Y find-principals/verify is needed for ssh signature verification (available in openssh version 8.2p1+)"));
>  		goto out;
>  	}
> +
>  	if (ret || !ssh_principals_out.len) {
>  		/*
>  		 * We did not find a matching principal in the allowedSigners
Stray whitespace change.
Show 25 quoted lines
> +int parse_signed_buffer_metadata(const char *payload, const char *signer_header,
> +				 timestamp_t *payload_timestamp,
> +				 struct strbuf *payload_signer)
> +{
> +	const char *ident_line = NULL;
> +	size_t ident_len;
> +	struct ident_split ident;
> +
> +	ident_line = find_commit_header(payload, signer_header, &ident_len);
> +	if (ident_line && ident_len) {
> +		if (!split_ident_line(&ident, ident_line, ident_len)) {
> +			if (payload_timestamp && ident.date_begin &&
> +			    ident.date_end)
> +				*payload_timestamp = parse_timestamp(
> +					ident.date_begin, NULL, 10);
> +			if (payload_signer)
> +				strbuf_add(payload_signer, ident.mail_begin,
> +					(ident.mail_end - ident.mail_begin));
> +
> +			return 0;
> +		}
> +	}
> +
> +	return 1;
> +}
This would be more readable with less nesting, i.e. instead of:
    if (x) {
        if (y) {
            [...]
Doing:
    if (!x)
        return 1;
    if (!y)
        return 1;
I.e. only if you get zero from split_ident_line() do you return 0.
Previous: Fabian StelzerNext: Fabian Stelzer
Message 7 of 14 in “ssh signing: verify key lifetime”
  1. 0/6 ssh signing: verify key lifetimeFabian Stelzer, Oct 22, 2021
  2. 1/6 ssh signing: extend check_signature to accept payload metadataFabian Stelzer, Oct 22, 2021
  3. Junio C HamanoOct 23, 2021
  4. Fabian StelzerOct 25, 2021
  5. Junio C HamanoOct 25, 2021
  6. 3/6 ssh signing: verify-commit/check_signature with commit dateFabian Stelzer, Oct 22, 2021
  7. Ævar Arnfjörð BjarmasonOct 22, 2021
  8. Fabian StelzerOct 25, 2021
  9. 4/6 ssh signing: git log/check_signature with commit dateFabian Stelzer, Oct 22, 2021
  10. 5/6 ssh signing: verify-tag/check_signature with tag dateFabian Stelzer, Oct 22, 2021
  11. 6/6 ssh signing: fmt-merge-msg/check_signature with tag dateFabian Stelzer, Oct 22, 2021
  12. Ævar Arnfjörð BjarmasonOct 22, 2021
  13. Fabian StelzerOct 25, 2021
  14. 2/6 ssh signing: add key lifetime test prereqsFabian Stelzer, Oct 22, 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.