gitpython-developers / GitPython

GitPython is a python library used to interact with Git repositories.
http://gitpython.readthedocs.org
BSD 3-Clause "New" or "Revised" License
4.64k stars 905 forks source link

GPG signatures for source validation #612

Closed NicoHood closed 7 years ago

NicoHood commented 7 years ago

As we all know, today more than ever before, it is crucial to be able to trust our computing environments. One of the main difficulties that package maintainers of Linux distributions face, is the difficulty to verify the authenticity and the integrity of the source code.

The Arch Linux team would appreciate it if you would provide us GPG signatures in order to verify easily and quickly your source code releases.

Overview of the required tasks:

GPGit is meant to bring GPG to the masses. It is not only a shell script that automates the process of creating new signed git releases with GPG but also comes with this step-by-step readme guide for learning how to use GPG.

Additional Information:

Thanks in advance.

PS: I plan to use this module in gpgit soon. However this and #611 is a blocking issue for this to happen. Would be really nice to see gpg signatures as well as this project part of gpgit.

Byron commented 7 years ago

Thanks for offering your help in increasing the trustworthyness of GitPython releases! For now this is only assured by github, as it allows only a few select people to push into this repository. I will just generate a new key and see how far I get :).

NicoHood commented 7 years ago

This would be highly appreciated as currently we cannot fully trust the downloads. GPG would be much of a help.

Byron commented 7 years ago

For a start, here is my public gpg key. I have made it known to github will use it to sign all my commits from now on.

(1) Sebastian Thiel (In Rust I trust!) <byronimo@gmail.com>
      4096 bit RSA key 9FEE1C6A3B07188F, created: 2017-04-24

So far I have never produced archives for use in distribution. In that area I would need a few more hints on how you suggest this should be accomplished. Personally I would be happiest if the current machinery using pip can be used to produce signed archives for download from pip.

What do you think about that?

For completeness, find below my public gpg key.

``` -----BEGIN PGP PUBLIC KEY BLOCK----- Comment: GPGTools - https://gpgtools.org mQINBFj+MasBEACak+exWFzTyjtJfz1D7WgSSJ19ZW36IfAX4/E2cxLCZ/hFUPqE +9EI0EsmysDs6m7eYk5TIIeqHlGtAQRcryTAMK7swd0ORGG0N7NJxAuc9cWomZII I+vrQI0VcQGr1ovXROz7Zf6wuN2GLRpQm4p4CAA/bC6NRAEn9uTwmKrW/Xv+Hhro QWznTgNsOCb4wu8BZs0UkH/9ZG67Jhf/5sqI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RMxP9lL1YvSnHRTbIRl6BCNdsQ/BOmuM9J16MhwhdaAUNZ4+69pTcq7nI7ZwH ghnSM2Vc3z93vo+rEP6nW1pwk9U4qBz2y4hCfPmV2aAJhN8f9z+CP0BJufn1EGIY VU1jS4pn/12GwXykdKs2g396QjuQsGzAq9QpbAciv8M9sg2KYIh2DNWqo6DTTh+e HSWeGVYAuhexlBmMSb/hqwARAQABiQIfBBgBCgAJBQJY/jGrAhsMAAoJEJ/uHGo7 BxiP0SMP/R85QTEgJz+RN4rplWbjZAUKMfN2QWqYCD5k20vBooVnTDkY4IM5wQ+q YP+1t/D1eLGTZ1uX9eZshIWXXakTJYla+niT8aP4SllNNwfeyZcCn1SwRAZ0ycjj xN24rhV0aMWvtTrvo1kph9ac275ktNXVlFlrPsFokpK9Ds14Uzk7m2mqEBEH/TlO Y4nBegRs6SmdBWOwKDWAINh+yzvFkTLr5r10D7aUukYuPZAiwnya0kLLXnoPmcys LNxFuys78dS8EDC4WFWNVMdzvcUl3LArnfwYT7KqoR/j/MTps3fEq4tqhTxxVuV9 W53sF4pRqj8JTTZxKXz+50iRpT48VLBcCCsXU208giiFZCKgJgHtaxwNK6eezf7b JaYfyg2ENmyp/tYsyZcCTv5Ku61sP3zu3lPHD4PNyTVpE60N/AAZaF0wRNmIVMoj HaXTXPiBJHhmfI/AgtJ25HibifFLal/16bOQ58n/vgkdMomGfb7XZWEyO/zxEfhZ OrUp1xSVgGdCflCEa95pWA6GSDxCsTSxkMUCYkaLPhE+JBFUq35ge4wsd1yS+YqA 2hI42+X8+WGxrobK2g2ZElEi92yqVuyUokA3aDbZDy9On3Hd9G7Bjxm7GKJ6vRTv Mqb/lQkte2hBEShNrGSVAGNCkMv+jFlhVSB3OnVJcLQ2JVBW9Uyv =H2BO -----END PGP PUBLIC KEY BLOCK----- ```
ankostis commented 7 years ago

Personally I would be happiest if the current machinery using pip can be used to produce signed archives for download from pip.

@byron twine should be your one-stop solution for uploading to PyPi repo.

NicoHood commented 7 years ago

thanks! twine looks good for pypi. Please use gpgit for the github source tarballs and everything will be good to go :)

Byron commented 7 years ago

@NicoHood There are no source-tarballs on github and I wasn't planning to release it that way. Pypi provides tarballs as well along with signatures. Thus I will be closing this issue and hope you will be alright.

NicoHood commented 7 years ago

@Byron Thanks. There are always auto generated github source tarballs. But it is more secure to generate your own (for example with GPGit).

Please also sign gitdb and smmap: https://pypi.python.org/pypi/gitdb https://pypi.python.org/pypi/smmap/0.9.0

Also the pypi versions seem to be outdated. On Github you have smmap 2.0.3 and on pypi 0.9

Byron commented 7 years ago

Thanks for the clarification! To keep things simple though, I would like to refer people to the signed tarballs on pypi instead. On the other note, gitdb and smmap are old packages owned by an account I am unable to access anymore, so the gitdb2 and smmap2 packages have been created instead. They are signed by now as well :).

NicoHood commented 7 years ago

@byron No the pypi guys can NOT sign the tarballs. The idea behind signing is security, not having a signature. If you upload it to them, they cannot verify if its uploaded really by you (account compromised etc). You need to sign it always in order to have the trustchain way up to the end user.

We as package maintainer package the software and sign them with our gpg keys which are trusted by the Archlinux keyring. However we also need to have a signature from you that we trust. So in the end the user trusts us (package maintainers) and also you. If you add another spot (pypi signatures) makes it less secure. And you cannot avoid signing your sources anyways. There is no way around that you sign the sources that you develop.

Byron commented 7 years ago

@NicoHood I think I understand exactly what you mean. This is also why I am confused - after all the tarball/binaries I upload (see screenshot) ship with a signature I created. Once you have trusted the key that signed them is truly mine, you can verify the tarball was created by me.

screen shot 2017-06-17 at 18 33 27

However, your comment seems to indicate that you cannot trust or use the files provided on pypi. To my mind this works fine, as I tried it myself and wrote about it in the readme.

Is there something I don't see?

NicoHood commented 7 years ago

It is all fine now unless you keep your key secret with a strong passphrase.

We do not need to trust pypi, as your sources are signed now. But if they would resign them with their key (as you suggested) this would be bad. As we need to trust them, that they verify your software correct. Its just another risk in the chain we want to avoid. As it is right now, it is perfect. Thanks a lot!

NicoHood commented 6 years ago

@Byron The GPG key used for signing the gitpython tarballs has recently changed. In order to verify the sources properly we cannot blindly trust the new key. Can you please give me some more information why the key changed and which fingerprint is the new one? It would be best to write the key down somewhere in the readme. In the current readme the old key is still present.

This is the old key: 4477ADC5977D7C60D2A7E3789FEE1C6A3B07188F

makepkg reports me the new (short) keyid: 665F99FA9D99966C which is not found on a keyserver.

Edit: talking about the signature for release 2.1.8

Byron commented 6 years ago

@NicoHood That's true! I changed my key in this commit (c7f657fb20c063dfc2a653f050accc9c40d06a60) as my previous one was susceptible to that new attack which derives the private key from a public key. Thus I generated new keys in software and placed them on my yubikey. Indeed, my previous key was revoked without a reason, but I think it was just me missing that flag on the command-line.

Additionally I tried to understand why the alleged signing key fingerprint is 665F99FA9D99966C, and realized that this is the fingerprint of my signing subkey. What worked for me is to import my most recent master key (via my email address, or by importing the signing key file) and list the key in all details via gpg --with-colons --list-key 2CF6E0B51AAF73F09B1C21174D1DA68C88710E60.

You will also find that all my commits are signed with the new key already. I hope that helps.

NicoHood commented 6 years ago

Alright. Make sure to also edit the readme then with the new key :)

Byron commented 6 years ago

@NicoHood Thanks a lot for hinting at it once again :)! Totally forgot that was there :D!

NicoHood commented 6 years ago

The gpg key got revoked. See https://github.com/gitpython-developers/smmap/issues/36#issuecomment-401588237

Please reopen or fix the issue.

Byron commented 6 years ago

Sorry for the late reply. I have published version 2.1.11 with my most recent key in the hopes that this fixes the issue you encountered.