News for hackers. Stuff that matters.
Re:Welp, there go my Git signatures by hdhzy on Tuesday October 24, 2017 @03:28PM (#15544488)
> I don't validate an entire codebase every time I commit.

Linus' point is that you don't need to validate the entire code base, if you have one signed commit then everything that is "below" is also (implicitly) signed. For example you can have a feature branch that has many small commits and one merge commit that joins feature branch with master and you just need to sign the merge commit to make sure all of these small commits are OK.

Re:Welp, there go my Git signatures by stouset on Tuesday October 24, 2017 @07:41PM (#15546165)
> Linus' point is that you don't need to validate the entire code base, if you have one signed commit then everything that is "below" is also (implicitly) signed.

And Linus is missing the point entirely.

Yes, signing a commit implicitly signs the repo all the way back to its beginning. But when I'm actually performing the action of signing this commit, I am not actually going back through every commit and verifying them.

The fact that you can use the properties of commit hashes to verify a chain all the way back to the origin of the repo is irrelevant, because that's not what someone actually signing a commit is intending or should be expected to do.

When I'm signing a commit, I'm vouching that I am responsible for applying this set of changes to a given state of a repo. It says nothing about my belief in the validity of changes to the repo made before it.

Re:Welp, there go my Git signatures by amazingman on Wednesday October 25, 2017 @02:22AM (#15547935)
>> For example you can have a feature branch that has many small commits and one merge commit that joins feature branch with master and you just need to sign the merge commit to make sure all of these small commits are OK.

The above example still makes sense, even given your point about the mild absurdity of the idea that the entire repo is implicitly trusted.

Re:Welp, there go my Git signatures by stouset on Wednesday October 25, 2017 @03:29PM (#15553317)
While this is technically true, what's the point in making the whole thing more complicated?

Say you relax the restrictions such that only the first parent of every commit must be signed. While this might make sense for a small branch edited by one person, what if it was a long-lived branch modified by multiple people?

The only case I can see for such a system is if you're doing a pull-request based workflow where your code review tool (GHE, Bitbucket, whatever) is the only tool capable of updating `master` and produces signed merge commits whenever a branch passes code review. Then you can at least (in theory) attest that all commits to master have been reviewed.

But if not that, and people are signing their commits to master anyway (which you can automate in your `~/.gitconfig`, why allow exemptions to commits on branches?

Re:Welp, there go my Git signatures by hdhzy on Wednesday October 25, 2017 @04:36AM (#15548424)
> When I'm signing a commit, I'm vouching that I am responsible for applying this set of changes to a given state of a repo. It says nothing about my belief in the validity of changes to the repo made before it.

Then you should be signing a diff not a commit. Signing a commit represents something different, because commit references both the current tree (all files) and parent commit you're basically vouching for all history and all files.

For reference, git commit structure [0]:

    $ git cat-file -p ca82a6dff817ec66f44342007202690a93763949
    tree cfda3bf379e4f8dba8717dee55aab78aef7f4daf
    parent 085bb3bcb608e1e8451d4b2432f8ecbe6306e7e7
    author Scott Chacon <[email protected]> 1205815931 -0700
    committer Scott Chacon <[email protected]> 1240030591 -0700

    changed the version number
[0]: https://git-scm.com/book/en/v2/Git-Internals-Transfer-Protoc...
Re:Welp, there go my Git signatures by Ajedi32 on Wednesday October 25, 2017 @10:04AM (#15550193)
That's ridiculous. If I signed a statement saying "The file with this hash is malware: <hash here>" would you say that "you're basically vouching for that file" just because my statement contained the file's hash?

Similarly, if I sign a commit containing `parent 085bb3bcb608e1e8451d4b2432f8ecbe6306e7e7`, that says nothing about whether I consider all previous commits to be valid. It only says that the commit I just signed was created based off of that parent commit, and that in order to see the changes I actually made you'll need to diff against that parent. (Which `git show <my commit id>` will do automatically.)

Re:Welp, there go my Git signatures by hdhzy on Wednesday October 25, 2017 @10:36AM (#15550443)
I think I used the word vouch incorrectly. When you sign a commit you indicate that your changes can be applied only on that particular parent even if all files or diffs were bit for bit identical. If it didn't work like that someone could take your work and place it in a completely different project and claim it was signed by you.

Note that even with signed commits there are same gaps in the system. For example without signed pushes someone can take your signed commit from branch "test" an push it to "master".

Re:Welp, there go my Git signatures by stouset on Wednesday October 25, 2017 @03:08PM (#15553146)
Signing a diff by itself is useless, because there's no attestation to what exactly is being diffed.

Just because a signing a commit can be construed as the author attesting to the authenticity of every single bit in the a repo's entire commit history doesn't mean it should, doesn't mean it's what the signing party actually intended, and doesn't mean that such an inference even remotely sane. Such an expectation is utterly absurd on its face for any repo with more than a handful of commits and/or authors.

Further, git does not have a mechanism for signing either diffs or diffs plus the `tree` of the prior commit plus all of the other commit metadata. Even if it did, there's now the problem that by excluding the prior commit, you now have no way of ensuring that signed commits are properly ordered if they happen to share `tree`s (e.g., in the case of a revert). This is a patently terrible property from a cryptographic perspective.

Given the above, there is literally no native way in git to achieve the semantics of signing a singular diff. Combined with the complete absurdity of assuming a signed commit is attesting to tens of thousands of commits or more from dozens of authors or more preceding it, signing commits is the most natural way to express the useful semantic of "I made this change to this tree".

The semantics you suggest are totally unrealistic and virtually useless in practice, so what exactly is the point of your argument?

Re:Welp, there go my Git signatures by Sean1708 on Wednesday October 25, 2017 @09:35AM (#15549938)
How do you just a diff in git?
Re:Welp, there go my Git signatures by hdhzy on Wednesday October 25, 2017 @09:42AM (#15549999)
That's workflow similar to what Linux Kernel uses: http://www.vflare.org/2009/09/linux-kernel-workflow-with-git...
Re:Welp, there go my Git signatures by CaliforniaKarl on Tuesday October 24, 2017 @03:49PM (#15544653)
In our group's use case, we're not after the "implicitly-signed" property. We are trying to ensure that the person who is listed as doing the commit actually did the commit. We then have a server-side hook script, which ensures each new commit has been signed by a key kept in a local keyring.
Re:Welp, there go my Git signatures by hdhzy on Tuesday October 24, 2017 @04:20PM (#15544913)
Just out of curiosity do you somehow update the local keyring? So that one can update their key information (for example to add revocations and new keys).
Re:Welp, there go my Git signatures by CaliforniaKarl on Tuesday October 24, 2017 @05:43PM (#15545497)
There's a single-digit number of people who can update the local keyring. Which works right now, given that the number of people who push to the repos concerned is in the double-digit range.

Our PGP keys don't really change that often.