Description
Gitea Version
1.16.0
Git Version
2.35.0
Operating System
Ubuntu 20.04.3, aarch64/arm64
How are you running Gitea?
Built myself from tag v1.16.0
Also reproducible on https://try.gitea.io
Database
PostgreSQL
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Description
If a commit is signed from a collaborator with the GPG key added to the collaborator's account, it will show as "untrusted" in the commit list.
git log shows good signature:
>git log --show-signature
──────────────────────────────────────────────────────────────────────────────────┐
commit 1f4ffc3844456d7d577801f2d09039c682bd195e (HEAD -> test, origin/test, main) │
──────────────────────────────────────────────────────────────────────────────────┴
gpg: Signature made 1/31/2022 2:38:23 PM Central Standard Time
gpg: using RSA key D00D9F014F64FD0D6B9E469D4D9DED295F42CF55
gpg: Good signature from "Parnic <parnic@parnic.com>" [ultimate]
Author: Parnic <parnic@parnic.com>
Date: Mon Jan 31 14:38:23 2022 -0600
Test
That key is added to that user's try.gitea.io account, but the commit shows untrusted (using try.gitea.io's default trust model):
https://try.gitea.io/parnic-sks/signature-test/commit/1c09133de06bb343eb9ed090ca7a37e6eac46bb1
edit: updated to a commit with the correct committer address: https://try.gitea.io/parnic-sks/signature-test/commit/1f4ffc3844456d7d577801f2d09039c682bd195e
Commits from the repo admin do still show as trusted, however. I suspect that's because the code seems to only be trusting repo admins. There are 4 similar calls to CalculateTrustStatus()
, but all use this IsUserRepoAdmin
func for the isCodeReader
argument, and pass either nil
or an empty map[string]bool{}
as the final keyMap
argument, e.g.:
if err := asymkey_model.CalculateTrustStatus(verification, ctx.Repo.Repository.GetTrustModel(), func(user *user_model.User) (bool, error) {
return models.IsUserRepoAdmin(ctx.Repo.Repository, user)
}, nil); err != nil {
[...]
The only way to get the commit to show as Trusted is to change the trust model to Committer, but that causes commits from Gitea itself (such as PR squash-merges) to show as untrusted.