mainSavannah Administration - Support: sr #109104, Add Git 'update' hook for Guix...


sr #109104: Add Git 'update' hook for Guix repositories

Submitter:  Ludovic Courtès <civodul>
Submitted:  Sun 24 Jul 2016 10:09:45 PM UTC
Category:  Source code repositories - developer access Priority:  5 - Normal
Severity:  3 - Normal Status:  Done
Assigned to:  rwp Operating System:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup

Wed 17 Aug 2016 09:38:36 AM UTC, comment #5: 

Hi Mike,

The hook is indeed super naive.  The goal was just to avoid accidental pushes of unsigned commits, under the assumption that those with commit access are well-behaved.  :-)

But yeah, the goal is to ultimately scan the Git history and ensure only authorized keys are used: .


Ludovic Courtès <civodul>
Sun 07 Aug 2016 05:53:39 AM UTC, comment #4: 

Unfortunately, this hook can be easily defeated.  Here's some example output from the current tip of master:

$ git cat-file -p HEAD
tree c65e675351fe76b2630df24eddcb2449774eb344
parent e87c7ec2de815f05d7a84e2792e2da700bb26a38
author Leo Famulari <> 1470169005 -0400
committer Leo Famulari <> 1470538536 -0400
gpgsig -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2


gnu: Add python-pythondialog.

* gnu/packages/python.scm (python-pythondialog): New variable.
(python2-pythondialog): Inherit from PYTHON-PYTHONDIALOG.

Co-authored-by: Vincent Legoll <>

The hook currently greps for `^gpgsig '.  It will indeed find a GPG signature if it exists, but to circumvent it, an attacker need only put `gpgsig' in the commit message at column 0---the commit messages aren't indented in the output.

You can replace the entire loop in the hook with this:

git log --pretty='%GK %h %s' "$rev_old^..$rev_new" \
  | awk '/^ / {
           print "error: missing signature:" $0 > "/dev/stderr"
         END { exit e }'

If the commit is not signed, then `%GK` (GPG key id) will yield an empty string.

Here's some example output (run with HEAD~15..):

error: missing signature: 7ccb874 gnu: zsh: Move to shells.scm.
error: missing signature: 7977d76 Update NEWS.

Mike Gerwitz <mikegerwitz>
Site Administrator
Mon 25 Jul 2016 09:00:23 AM UTC, comment #3: 

That was fast, thanks a lot, Bob!

Ludovic Courtès <civodul>
Sun 24 Jul 2016 10:57:48 PM UTC, comment #2: 

Done. Commits to those repositories will be required to be gpg signed now. Let us know if you need anything else.

Bob Proulx <rwp>
Site Administrator
Sun 24 Jul 2016 10:51:42 PM UTC, comment #1: 

Sure thing. I will add it to this list.


Bob Proulx <rwp>
Site Administrator
Sun 24 Jul 2016 10:09:45 PM UTC, original submission:  


Could you add the attach file as an 'update' hook for all the Guix repositories?

Thanks in advance,

Ludovic Courtès <civodul>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #38011:  assert-commit-signed added by civodul (764B - application/octet-stream - Git 'update' hook to reject unsigned commits)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by mikegerwitz (Posted a comment)
  • -email is unavailable- added by rwp (Posted a comment)
  • -email is unavailable- added by civodul (Submitted the item)
  • -email is unavailable- added by civodul

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-07-24 rwp StatusIn Progress Done
        Open/ClosedOpen Closed
    2016-07-24 rwp StatusNone In Progress
        Assigned toNone rwp
    2016-07-24 civodul Attached File- Added assert-commit-signed, #38011
        Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.12