Skip to content
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

GPG not using correct UID #6778

Closed
2 of 7 tasks
crabctrl opened this issue Apr 27, 2019 · 14 comments · Fixed by #12486
Closed
2 of 7 tasks

GPG not using correct UID #6778

crabctrl opened this issue Apr 27, 2019 · 14 comments · Fixed by #12486
Labels

Comments

@crabctrl
Copy link

crabctrl commented Apr 27, 2019

  • Gitea version (or commit ref): 1.7.0
  • Git version: 2.21.0
  • Operating system: Linux
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes
    • No
    • Not relevant

Description

My GPG key has a revoked UID attached to it (it was revoked since I no longer own the email address it refers to). My primary UID is valid, and the email address it points to has been added to my Gitea account. However, when trying to add my key, Gitea displays the old (revoked) UID as the primary, and any commits signed using the updated key are marked as No known key. I tried removing my old email address from my account, and now Gitea just says my I need to have my old address attached in order to load the key.

It seem that Gitea is not correctly loading the primary UID. In addition, the commits should still be verified even with the updated key; it should be loading all UIDs ideally. Any help would be greatly appreciated.

@lafriks
Copy link
Member

lafriks commented Apr 27, 2019

Can you give your public gpg key that is problematic?

@lafriks lafriks added the issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail label Apr 27, 2019
@crabctrl
Copy link
Author

My key fingerprint is 0E72F749E5D4E92F1F1D5F2BCDAD63AE9DA934BE, the actual key is:

-----BEGIN PGP PUBLIC KEY BLOCK-----

mDMEXHmwNRYJKwYBBAHaRw8BAQdADJQJlOscbuBH+CyJC9GVm3kKBD0Az8Ew7yqy
MzQgwDm0KUFsZGVuIFBlZXRlcnMgPGFsZGVuLnBlZXRlcnNAbGVhZ3VlaC54eXo+
iJkEExYIAEECGwMFCwkIBwIGFQoJCAsCBBYCAwECHgECF4ACGQEWIQQOcvdJ5dTp
Lx8dXyvNrWOun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sapk commented Apr 28, 2019

Looking at your public key, the old UID is still the primary UID. It would need to check what identities is returned in from this keys where we search for matching emails.

for _, ident := range e.Identities {

sapk added a commit to sapk-fork/gitea that referenced this issue Apr 29, 2019
@sapk
Copy link
Member

sapk commented Apr 29, 2019

I added a test to debug, and I seems to get both emails listed so it should match at least your new email. I need to look further to find the mismatch.

@sapk
Copy link
Member

sapk commented Apr 29, 2019

Maybe we should update the lib: keybase/go-crypto@2c2b831#diff-e7ace1eeeac9cdf4f5fe331bf53e3fb2

@sapk sapk mentioned this issue Apr 29, 2019
2 tasks
@xf-
Copy link
Contributor

xf- commented Apr 30, 2019

I use also multiple mail addresses in my key and commit with different once (work, private...).
@sapk you only look into loading issue of primary and not to load all UIDs or?

@sapk
Copy link
Member

sapk commented Apr 30, 2019

@xf- We load all identities that are linked to the key. The problem here is that an identities is revoked in the key export and the lib we use still list it as a good identities. In fact if I recall well my testing, it doesn't even match/return the revocation.

@xf-
Copy link
Contributor

xf- commented Apr 30, 2019

@sapk deleted the key and imported it again. Now it works! THX

@crabctrl
Copy link
Author

crabctrl commented May 5, 2019

Is something still needed from me? (I only ask because of the label)

@sapk
Copy link
Member

sapk commented May 5, 2019

@atoms118 No we have enough to reproduce (added as a test in #6794), To be fixed we would need to fix it in the lib we use that seems to list the identities of the revoked uid when it shouldn't (but doesn't list revoked uid for the key listed in there tests 😕). I haven't look futhermore.

@techknowlogick techknowlogick added type/bug and removed issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail labels May 5, 2019
@stale
Copy link

stale bot commented Jul 4, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale stale bot added the issue/stale label Jul 4, 2019
@sapk
Copy link
Member

sapk commented Jul 4, 2019

This issue need to be kept open.

@stale stale bot removed the issue/stale label Jul 4, 2019
@zeripath zeripath added the issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented label Jul 4, 2019
sapk added a commit to sapk-fork/gitea that referenced this issue Feb 11, 2020
@zeripath
Copy link
Contributor

I am suspicious that this might have been resolved by #12155

zeripath added a commit to zeripath/gitea that referenced this issue Aug 13, 2020
@zeripath
Copy link
Contributor

OK I'm not certain completely what's going on here.

There's likely a part of this issue which has been resolved by #12155 (which affects subkey verifcation.)

Another part is likely fixed by @techknowlogick's recent PR removing the email address reporting on a commit - (so not necessarily fixed but masked).

Now there is the question about whether we should be verifying against a revoked identity, and #12486 stops that but... I think we need to double check against what GH does for revoked IDs. There's an issue with the way GH uses git signatures here - it uses them as committer verification and therefore a signature matching a revoked email address is not necessarily incorrect.

There is a final potential issue that I can see:

When you are posting your keys are you pasting multiple keys on a single keyring? Because Gitea isn't currently set up to do - it would be possible to cope with that but it's not doing that at present.

zeripath added a commit to zeripath/gitea that referenced this issue Aug 13, 2020
zeripath added a commit that referenced this issue Aug 16, 2020
zeripath added a commit to zeripath/gitea that referenced this issue Aug 16, 2020
techknowlogick pushed a commit that referenced this issue Aug 17, 2020
Backport #12486

Fix #6778

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: Lunny Xiao <[email protected]>
lafriks added a commit that referenced this issue Aug 21, 2020
Related #6778

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: Lauris BH <[email protected]>
@zeripath zeripath removed the issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented label Oct 21, 2020
@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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants