From: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Philip Oakley <philipoakley@iee.email>,
"Gamblin, Todd" <gamblin2@llnl.gov>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Commit SHA1 == SHA1 checksum?
Date: Mon, 7 Feb 2022 18:02:05 -0500 [thread overview]
Message-ID: <20220207230205.m5dibcb52u7qemq4@meerkat.local> (raw)
In-Reply-To: <xmqqzgn2gumr.fsf@gitster.g>
On Mon, Feb 07, 2022 at 02:49:16PM -0800, Junio C Hamano wrote:
> Given a signed commit or a signed tag that points at a commit, your
> enhanced "git archive" would create a .tar file with the contents of
> the tree object, and adds copies signed objects that tells what tree
> object the archive ought to have. E.g. if you start from a signed
> tag, "git cat-file tag $tag" output would allow you to learn the
> object name of the tagged object, and to verify the PGP signature
> embedded in the tag, but it is likely that the tagged object is a
> commit, not a tree, so you'd also need to include "git cat-file
> commit $tag^{commit}".
Correct, unless it's a snapshot of a signed commit, not of a tag (cgit, for
example, makes them available for download). In this case we only need to have
the cat-file contents of the commit.
> So you'd store the raw contents of the tag
> (so that we have a hash-protected record of commit object name), and
> the commit (so that we have a hash-protected record of tree object
> name).
>
> You as the recipient will find these in the tarball:
>
> - the files that are supposed to be the contents of tree X.
>
> - the raw contents of the commit C that is supposed to record the
> tree X.
>
> - the raw contents of the tag T that is supposed to point at the
> commit C.
>
> Starting from the contents of tag T, which is PGP signed, you know
> that the signer wanted to call commit C with the name of the tag T.
> Then the raw contents that alledgedly are from commit C, you can
> "git hash-object -t commit" it to verify that it indeed hashes down
> to C (hence, it what the signer wanted to give you), and find the
> name of the tree object X the commit records. And when you added
> all the blobs contained in the tarball (and nothing else) to the
> index and ran write-tree on the resulting index, you would know what
> tree object the tarball contained, and if it hashes down to X, you
> know that the cryptographic hash chain starting from PGP signature
> on T attests that that tarball matches what the signer wanted you
> to have.
Exactly right. It would be slightly more complicated for things like openssh
signatures, since then you have to worry about where the allowed_signers file
comes from, but these are implementation minutae. Even if we start with just
support for PGP signatures, that would already be a great improvement over
where things are with snapshot downloads right now.
Best regards,
-K
prev parent reply other threads:[~2022-02-08 1:09 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-05 1:19 Commit SHA1 == SHA1 checksum? Gamblin, Todd
2022-02-06 0:22 ` Philip Oakley
2022-02-06 9:00 ` Gamblin, Todd
2022-02-06 10:23 ` Johannes Sixt
2022-02-06 10:15 ` Junio C Hamano
2022-02-06 19:25 ` Philip Oakley
2022-02-06 20:02 ` Junio C Hamano
2022-02-06 21:33 ` Philip Oakley
2022-02-07 8:15 ` Gamblin, Todd
2022-02-07 13:15 ` Konstantin Ryabitsev
2022-02-07 21:08 ` Gamblin, Todd
2022-02-07 13:32 ` Konstantin Ryabitsev
2022-02-07 20:57 ` Junio C Hamano
2022-02-07 21:34 ` Konstantin Ryabitsev
2022-02-07 22:29 ` Gamblin, Todd
2022-02-07 22:46 ` Konstantin Ryabitsev
2022-02-08 6:23 ` Gamblin, Todd
2022-02-07 22:49 ` Junio C Hamano
2022-02-07 23:02 ` Konstantin Ryabitsev [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220207230205.m5dibcb52u7qemq4@meerkat.local \
--to=konstantin@linuxfoundation.org \
--cc=gamblin2@llnl.gov \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=philipoakley@iee.email \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).