-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to Sign gitea merges with pgp #7598
Comments
Since web browser could interactive with yubikey and etc. and yubikey could store gpg private key. I think that's possible. |
I also wonder if we could somehow use something asssociated with the 2fa system. |
I do think we need to have merges signed before we move to Gitea.com though. |
I mentioned this in another issue, but it's worth noting that GitHub uses a single key for all web-flow. |
I woild prefere the yubikey version. But jolheiser is probably simpler to implement |
Somebody any experience with openpgpjs? |
So, prior to my changes to use the index without checking out - we would have got web-flow for free - although unconfigurable through docker - if the running user of the gitea program had an appropriately set up .gitconfig. I think if we simply add OK it's a bit more complicated than that... but that's the gist of it. |
We can maybe simply call |
@sapk So I've needed to adjust the calls to The next thing is to sort out the verification code to check if it matches the default key and mark commits as signed if so - I should check how github signs things - if they're signing stuff they might have to be the committer or the author or something like that. Then we can get on with adjusting docker to create a gpg key as necessary and maybe add some more configurability to this. |
Aha! Github will only sign a merge if all the constituent commits were signed and won't sign web edited files either Actually it appears weirder than that as it didn't sign: #7622 |
Right, I think we need to think seriously about when and what we want to sign. First of all let's list the number of ways a commit can be made on the UI:
There are a number of options:
|
Next I think we need to think carefully about multiple key control. Presumably we'd like to be able to allow Organisations and/or individuals to have their own keys. There are two options:
If we're storing on the server: passing around private keys is not really appropriate - so these keys would have to be generated in Gitea and kept on the server if Gitea is going to sign these. We would then have to provide some way for users to sign the public keys and upload their signatures of these public keys to indicate their trust. Edit: Thinking on we could use subkeys for this - the user encrypts their private subkey with the gitea public key, which gitea can then decrypt using its private key, storing both a decrypted public key in the db and some encrypted version of the private key. How we store the private keys is an issue. Clearly storing these keys unencrypted is not ideal. However storing them encrypted with a plaintext password stored in the db is not much better. I don't know what to do. If using openpgpjs - we would have to generate the commit and then present the commit to the user to sign. I think it would be difficult to wire openpgpjs into the commit making process - and in any case you only sign the commit not the tree. For both: We could provide a way of signing commits and adding them to signed branch? Given a signed commit and a non signed commit you can assert that they are of the same thing even if they have different parents. That allows a user to step through a branch and sign each commit in order. |
…7631) This PR fixes #7598 by providing a configurable way of signing commits across the Gitea instance. Per repository configurability and import/generation of trusted secure keys is not provided by this PR - from a security PoV that's probably impossible to do properly. Similarly web-signing, that is asking the user to sign something, is not implemented - this could be done at a later stage however. ## Features - [x] If commit.gpgsign is set in .gitconfig sign commits and files created through repofiles. (merges should already have been signed.) - [x] Verify commits signed with the default gpg as valid - [x] Signer, Committer and Author can all be different - [x] Allow signer to be arbitrarily different - We still require the key to have an activated email on Gitea. A more complete implementation would be to use a keyserver and mark external-or-unactivated with an "unknown" trust level icon. - [x] Add a signing-key.gpg endpoint to get the default gpg pub key if available - Rather than add a fake web-flow user I've added this as an endpoint on /api/v1/signing-key.gpg - [x] Try to match the default key with a user on gitea - this is done at verification time - [x] Make things configurable? - app.ini configuration done - [x] when checking commits are signed need to check if they're actually verifiable too - [x] Add documentation I have decided that adjusting the docker to create a default gpg key is not the correct thing to do and therefore have not implemented this.
smal note for an idear: sign gitea merges
The text was updated successfully, but these errors were encountered: