trusted-keys is missing fingerprints for jgarzik/gmaxwell
Add script to verify all merge commits are signed #5149
pull TheBlueMatt wants to merge 1 commits into bitcoin:master from TheBlueMatt:verify-pgp changing 6 files +91 −0-
TheBlueMatt commented at 7:14 AM on October 27, 2014: member
-
laanwj commented at 8:19 AM on October 27, 2014: member
Good idea, but at least mention this in contrib/README.md
Edit: Looking through the commits, all jgarzik's commits and merges are signed with: Primary key fingerprint: AF8B E07C 7049 F3A2 6B23 9D53 25B3 0832 0178 2B2F
-
in contrib/verify-commits/verify-commits.sh:None in a3c6bda921 outdated
0 | @@ -0,0 +1,54 @@ 1 | +#!/bin/sh
sipa commented at 8:26 AM on October 27, 2014:This script seems to use bashisms, so better mark its interpreter as bash (it doesn't work here).
TheBlueMatt commented at 7:10 PM on October 27, 2014:Oh? Which ones?
sipa commented at 3:14 AM on October 28, 2014:functions, for one.
TheBlueMatt commented at 7:32 PM on October 28, 2014:Ehh, almost all shells people use support functions, not sure which one(s) dont at this point.
sipa commented at 8:34 AM on October 31, 2014:And apparently function definitions are indeed standard POSIX. But the 'function' keyword is not. You can just remove the 'function ' in front.
TheBlueMatt commented at 10:41 PM on November 1, 2014:Already had :)
in contrib/verify-commits/verify-commits.sh:None in a3c6bda921 outdated
33 | + HAVE_FAILED=true 34 | + fi 35 | + return 1; 36 | +} 37 | + 38 | +IS_SIGNED HEAD HEAD
sipa commented at 8:27 AM on October 27, 2014:Why 2x 'HEAD' ?
in contrib/verify-commits/verify-commits.sh:None in a3c6bda921 outdated
6 | +git log "$DIR" 7 | + 8 | +VERIFIED_ROOT=$(cat "${DIR}/trusted-git-root") 9 | + 10 | +ORIG_GPG=$(git config --local gpg.program) 11 | +git config gpg.program "${DIR}/gpg.sh"
sipa commented at 8:30 AM on October 27, 2014:You can use:
git -c "gpg.program=${DIR}/gpg.sh" command [args]instead of
git config gpg.program "${DIR}/gpg.sh" git command [args]in contrib/verify-commits/verify-commits.sh:None in a3c6bda921 outdated
18 | + if ! git verify-commit $1 > /dev/null 2>&1; then 19 | + return 1; 20 | + fi 21 | + local PARENTS=$(git show -s --format=format:%P $1) 22 | + for PARENT in $PARENTS; do 23 | + if IS_SIGNED $PARENT $1 > /dev/null; then
sipa commented at 8:33 AM on October 27, 2014:I don't think it's necessary to recurse into the second part (which is the commit being merged). Also, how many recursion levels does bash support?
EDIT: misread the first time
TheBlueMatt commented at 7:13 PM on October 27, 2014:I'm not sure it is either, but its easy enough and for completeness it should be there.
in contrib/verify-commits/gpg.sh:None in a3c6bda921 outdated
0 | @@ -0,0 +1,15 @@ 1 | +#!/bin/sh 2 | +INPUT=$(cat /dev/stdin)
sipa commented at 8:36 AM on October 27, 2014:$(</dev/stdin) is faster
theuni commented at 7:18 AM on October 28, 2014: memberThe verify script seems overly complex to me if it's just supposed to be verifying merge commits. I took a stab at it and came up with:
#!/bin/sh DIR="`git rev-parse --show-toplevel`/contrib/verify-commits" VERIFIED_ROOT=`< "${DIR}/trusted-git-root"` TEST_COMMIT="$1" RET=0 for i in `git rev-list --min-parents=2 --max-parents=2 "${VERIFIED_ROOT}".."${TEST_COMMIT}"`; do git -c "gpg.program=${DIR}/gpg.sh" verify-commit $i >/dev/null || \ ( echo "$i was not signed with a trusted key!"; false ) || RET=`expr $RET + 1` done exit $RETIs there a reason for using recursive bottom-up traversal rather than the simpler top-down from the merges?
sipa commented at 7:53 AM on October 28, 2014: membergit rev-list --first-parentseems to do the thing we want (though it seems @TheBlueMatt also wants to cover the case where a (recursively) signed commit is signed merged into a non-signed branch).TheBlueMatt commented at 7:37 PM on October 28, 2014: memberTechnically, merge commit parents dont have to be in a specific order, so even though if using the merge shell script in contrib you wouldnt hit it, it is not unreasonable for someone to have been developing on their own branch, merging two pulls or so, and then merging that branch.
laanwj added the label Docs and Output on Oct 29, 2014sipa commented at 4:17 PM on October 31, 2014: member@TheBlueMatt Well, sure, but "git merge branch" will have the current HEAD as first parent and branch as second parent (assuming it wasn't a fast forward), so I don't see how anything merged into master should not have its first parent (and its first parents) signed.
TheBlueMatt commented at 10:41 PM on November 1, 2014: member@sipa Indeed, though my point was more that its not unreasonable to be on a separate branch and merge in master. While we try to keep our git history clean of that kind of confusion, its not incorrect and not unreasonable for it to happen, so I find it better to support it.
TheBlueMatt force-pushed on Nov 12, 2014TheBlueMatt commented at 11:44 PM on November 12, 2014: memberUpdated the commit base because @gavinandresen insists on merging without signing his commits and squashed.
sipa commented at 10:28 AM on November 13, 2014: memberI believe this code can lead to exponential time in the number of merges :)
TheBlueMatt commented at 7:45 PM on November 13, 2014: memberIn an unrealistic worst-case, yes...if someone who's key was on the list started signing all of their commits, it is possible that it would go quite far down both sides of a merge, however, in any other case, it wont pass one commit down a merge branch that isnt followed by other merges.
jgarzik commented at 4:28 AM on November 14, 2014: contributorOne solution employed in kernel-land is hooks. I wonder how possible it is to hook something like this PR's script with a pre-commit hook that prevents pushes containing unsigned merge commits.
TheBlueMatt commented at 7:27 AM on November 14, 2014: member@jgarzik sounds good...is there a way to limit a hook to only apply if you're pushing to github.com/bitcoin/bitcoin?
Add script to verify all merge commits are signed adaa568722TheBlueMatt force-pushed on Dec 20, 2014TheBlueMatt commented at 5:41 AM on December 20, 2014: member@jgarzik To answer your question, yes. I updated this pull to (a) include @gmaxwell's pubkey, (b) there were several unsigned merges, so had to update the trusted root, (c) include a contrib/verify-commits/pre-push-hook.sh which, if copied to .git/hooks/pre-push (and you have bash installed), will prevent the pushing of unsigned commits to master on bitcoin/bitcoin (but not apply for any other repos).
gmaxwell commented at 8:02 AM on December 20, 2014: contributorof course, people can hit the merge button on github, and then the script will be broken after that, no?
TheBlueMatt commented at 8:13 AM on December 20, 2014: memberYes, this is why the script only applies to people with push access...if you hit the merge button, you'll require everyone else to update contrib/verify-commits/trusted-git-root (or simply disable the hook). Its enough that it'll remind everyone to sign their merges, but it doesnt block all unsigned code from getting uploaded, ie its easy to work around.
laanwj merged this on Mar 20, 2015laanwj closed this on Mar 20, 2015laanwj referenced this in commit c7abfa595d on Mar 20, 2015DrahtBot locked this on Sep 8, 2021
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-17 15:15 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me