Skip to content

GPG signed commit rendered differently if signed with subkey instead of master key. #30235

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
ligaard opened this issue Apr 1, 2024 · 5 comments · Fixed by #30245
Closed
Labels

Comments

@ligaard
Copy link

ligaard commented Apr 1, 2024

Description

A commit signed with a GPG key can be shown in grey, orange, or green in the commit list. This issue is about an inconsistency in the colouring of commits signed with a GPG master key versus a GPG subkey.

Steps to reproduce

Prerequisite: Have two verified GPG keys for the user. One with a master key and another with a subkey. Have git set up with a username that is not matching the username in Gitea.

When a commit is signed with a GPG subkey the color is grey and the hover text states "No known key found for this signature in the database". See attached screenshot marked with 1.

When the commit is signed with a GPG master key the color is orange and the hover text reads "Signed by untrusted user who does not match committer: ...". See attached screenshot marked with 2.

I would expect the color to have been orange for both these cases.

Additional info:

  • When the username signing the commit matches the Gitea user, then the signed commit is coloured green regardless of whether a GPG master key or a GPG subkey signed the commit. This is expected.
  • You must run a recent Gitea to be able to verify a GPG subkey, cf. issue #30189

Gitea Version

1.23.0+dev-39-gca297a90f

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

image

Git Version

1.23-dev

Operating System

Linux (via Docker Desktop on MacOS)

How are you running Gitea?

Running Gitea nightly image from docker hub.

Database

SQLite

@delvh
Copy link
Member

delvh commented Apr 1, 2024

Fixed with #30193

@delvh delvh closed this as completed Apr 1, 2024
@ligaard ligaard changed the title GPG signed commit rendered differently if signed with subway instead of master key. GPG signed commit rendered differently if signed with subkey instead of master key. Apr 1, 2024
@ligaard
Copy link
Author

ligaard commented Apr 1, 2024

@delvh : This is an additional problem. I reported the commit you reference as solving this. Please reopen this report.

@KN4CK3R
Copy link
Member

KN4CK3R commented Apr 2, 2024

Could you test if #30245 fixes your problem? If not I catched another bug.

@ligaard
Copy link
Author

ligaard commented Apr 2, 2024

Yes, it seems to work. I pulled the pull request and built a docker image, replaced the existing container with the new, and after reloading the webpage - voila, it works as expected as seen in the screenshot. So LGTM :-)
Skærmbillede 2024-04-02 kl  17 18 19

@KN4CK3R
Copy link
Member

KN4CK3R commented Apr 2, 2024

Great, thank you for confirming 🎉

KN4CK3R added a commit that referenced this issue Apr 2, 2024
Fixes #30235

If the key id "front" byte has a single digit, `%X` is missing the 0
prefix.
` 38D1A3EADDBEA9C` instead of
`038D1A3EADDBEA9C`
When using the `IssuerFingerprint` slice `%X` is enough but I changed it
to `%016X` too to be consistent.
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Apr 2, 2024
Fixes go-gitea#30235

If the key id "front" byte has a single digit, `%X` is missing the 0
prefix.
` 38D1A3EADDBEA9C` instead of
`038D1A3EADDBEA9C`
When using the `IssuerFingerprint` slice `%X` is enough but I changed it
to `%016X` too to be consistent.
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Apr 2, 2024
Fixes go-gitea#30235

If the key id "front" byte has a single digit, `%X` is missing the 0
prefix.
` 38D1A3EADDBEA9C` instead of
`038D1A3EADDBEA9C`
When using the `IssuerFingerprint` slice `%X` is enough but I changed it
to `%016X` too to be consistent.
KN4CK3R added a commit that referenced this issue Apr 2, 2024
Backport #30245 by @KN4CK3R

Fixes #30235

If the key id "front" byte has a single digit, `%X` is missing the 0
prefix.
` 38D1A3EADDBEA9C` instead of
`038D1A3EADDBEA9C`
When using the `IssuerFingerprint` slice `%X` is enough but I changed it
to `%016X` too to be consistent.

Co-authored-by: KN4CK3R <[email protected]>
KN4CK3R added a commit that referenced this issue Apr 2, 2024
Backport #30245 by @KN4CK3R

Fixes #30235

If the key id "front" byte has a single digit, `%X` is missing the 0
prefix.
` 38D1A3EADDBEA9C` instead of
`038D1A3EADDBEA9C`
When using the `IssuerFingerprint` slice `%X` is enough but I changed it
to `%016X` too to be consistent.

Co-authored-by: KN4CK3R <[email protected]>
HenriquerPimentel pushed a commit to HenriquerPimentel/gitea that referenced this issue Apr 2, 2024
Fixes go-gitea#30235

If the key id "front" byte has a single digit, `%X` is missing the 0
prefix.
` 38D1A3EADDBEA9C` instead of
`038D1A3EADDBEA9C`
When using the `IssuerFingerprint` slice `%X` is enough but I changed it
to `%016X` too to be consistent.
AvengerMoJo pushed a commit to AvengerMoJo/gitea that referenced this issue Apr 8, 2024
Fixes go-gitea#30235

If the key id "front" byte has a single digit, `%X` is missing the 0
prefix.
` 38D1A3EADDBEA9C` instead of
`038D1A3EADDBEA9C`
When using the `IssuerFingerprint` slice `%X` is enough but I changed it
to `%016X` too to be consistent.
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Jul 2, 2024
project-mirrors-bot-tu bot pushed a commit to project-mirrors/forgejo-as-gitea-fork that referenced this issue Jan 23, 2025
Fixes go-gitea#30235

If the key id "front" byte has a single digit, `%X` is missing the 0
prefix.
` 38D1A3EADDBEA9C` instead of
`038D1A3EADDBEA9C`
When using the `IssuerFingerprint` slice `%X` is enough but I changed it
to `%016X` too to be consistent.

(cherry picked from commit eb505b1)

Conflicts:
	- models/asymkey/gpg_key_commit_verification.go
          Ported the change to models/asymkey/gpg_key_object_verification.go
(cherry picked from commit 63904e2)
project-mirrors-bot-tu bot pushed a commit to project-mirrors/forgejo-as-gitea-fork that referenced this issue Jan 23, 2025
Backport go-gitea#30245 by @KN4CK3R

Fixes go-gitea#30235

If the key id "front" byte has a single digit, `%X` is missing the 0
prefix.
` 38D1A3EADDBEA9C` instead of
`038D1A3EADDBEA9C`
When using the `IssuerFingerprint` slice `%X` is enough but I changed it
to `%016X` too to be consistent.

Co-authored-by: KN4CK3R <[email protected]>
(cherry picked from commit 935bfe6)
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.

3 participants