Skip to content

add .gpg url (match github behaviour) #4193

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

Closed
wants to merge 7 commits into from
Closed

add .gpg url (match github behaviour) #4193

wants to merge 7 commits into from

Conversation

techknowlogick
Copy link
Member

Fix #3049

Note this is a WIP and I haven't actually tested that this works. Once I test it I will remove this message and mark as ready to review.

@techknowlogick techknowlogick added type/enhancement An improvement of existing functionality pr/wip This PR is not ready for review labels Jun 9, 2018
var buf bytes.Buffer
for i := range keys {
buf.WriteString(keys[i])
buf.WriteString("\n")
Copy link
Member

@silverwind silverwind Jun 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you check GitHub's behaviour with multiple keys, it's not just concatenating the BEGIN PGP PUBLIC KEY BLOCK blocks, but instead merging multiple keys into a single block. Not sure how it's done, but if we want to keep compatibilty, we should also do that.

Copy link
Member

@silverwind silverwind Jun 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it seems rather simple to merge with the gpg tool. Add both keys to a keyring and then do a gpg --armor --export without any additional arguments. This will output a merged block containing all the keys. Hopefully this is possible in pure go too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is helpful, and get's me pointed in the right direction. Thank you. Now to see how to do this in pure go, time to go read some documentation/dig through code.

Copy link
Member

@sapk sapk Jun 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tested but it might be enough to call Serialize on each key to the same writer. https://sourcegraph.com/github.com/keybase/go-crypto@670ebd3adf7a737d69ffe83a777a8e34eadc1b32/-/blob/openpgp/ecdh_test.go#L343

@bkcsoft bkcsoft added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 9, 2018

var buf bytes.Buffer
for i := range keys {
buf.WriteString(keys[i])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be keys[i].Content who contain the armored key.

models/user.go Outdated
@@ -655,7 +655,7 @@ func NewGhostUser() *User {

var (
reservedUsernames = []string{"assets", "css", "explore", "img", "js", "less", "plugins", "debug", "raw", "install", "api", "avatars", "user", "org", "help", "stars", "issues", "pulls", "commits", "repo", "template", "admin", "error", "new", ".", ".."}
reservedUserPatterns = []string{"*.keys"}
reservedUserPatterns = []string{"*.keys", ".gpg"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be *.gpg?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching that @silverwind. Changing it now.

@techknowlogick
Copy link
Member Author

Status update: I'm running into problems getting go to generate the base64 armor export of the entire keyring in pure go. I need to think some more and read some more documentation.

@silverwind
Copy link
Member

I guess if the necessary API just isn't there, we could opt for having the keys in multiple parts, until a better solution is found.

@techknowlogick techknowlogick added this to the 1.9.0 milestone Feb 11, 2019
@stale stale bot added the issue/stale label Apr 12, 2019
@techknowlogick techknowlogick added issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented and removed issue/stale labels Apr 13, 2019
@go-gitea go-gitea deleted a comment from stale bot Apr 13, 2019
@techknowlogick techknowlogick modified the milestones: 1.9.0, 1.x.x Apr 13, 2019
@sapk
Copy link
Member

sapk commented Apr 13, 2019

I have tested furthermore and we don't have enough data in the database to reconstruct the original GPG key as we only store the public key and not the signature and also other information like linked identities. The simple way to fix this would be to store the original import to a new column or table after that it should be easy to use them to join them in a single export.

@techknowlogick
Copy link
Member Author

Closing in support for @sapk's PR

@techknowlogick techknowlogick deleted the gpg_keys branch April 14, 2019 00:17
@lunny lunny removed this from the 1.x.x milestone Apr 14, 2019
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. pr/wip This PR is not ready for review type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(Optionally) expose SSH and GPG public keys via HTTP
5 participants