Currently the verify-commits.py
script does not work well with maintainers giving up their commit access. If a key is removed from trusted-keys
, any commits it signed previously will fail to verify, however keys cannot be kept in the list as it would allow that person to continue to push new commits. Furthermore, the trusted-keys
used depends on the working tree which verify-commits.py
itself may be modifying. When the script is run, the trusted-keys
may be the one that is intended to be used, but the script may change the tree to a different commit with a different trusted-keys
and use that instead!
To resolve these issues, I’ve updated verify-commits.py
to load the trusted-keys
file and check the keys itself rather than delegating that to gpg.sh
(which previously read in trusted-keys
). This avoids the issue with the tree changing.
I’ve also updated the script so that it stops modifying the tree. It would do this for the clean merge check where it would checkout each individual commit and attempt to reapply the merges, and then checking out the commit given as a cli arg. git merge-tree
lets us do basically that but without modifying the tree. It will give us the object id for the resulting tree which we can compare against the object id of the tree in the merge commit in question. This also appears to be quite a bit faster.
Lastly I’ve removed all of the exception commits in allow-revsig-commits
, allow-incorrect-sha512-commits
, and allow-unclean-merge-commits
since all of these predate the commits in trusted-git-root
and trusted-sha512-root
. I’ve also updated the script to skip verification of commits that predate trusted-git-root
, and skip sha512 verification for those that predate trusted-sha512-root
.