@@ -414,6 +414,7 @@ func ParseCommitWithSSHSignature(ctx context.Context, c *git.Commit, committer *
414
414
415
415
defaultReason := asymkey_model .NoKeyFound
416
416
417
+ // Covers ssh verification for the default SSH signing key specifed in gitea config
417
418
if setting .Repository .Signing .SigningFormat == git .KeyTypeSSH && setting .Repository .Signing .SigningKey != "" && setting .Repository .Signing .SigningKey != "default" && setting .Repository .Signing .SigningKey != "none" {
418
419
// OK we should try the default key
419
420
gpgSettings := git.GPGSettings {
@@ -425,9 +426,9 @@ func ParseCommitWithSSHSignature(ctx context.Context, c *git.Commit, committer *
425
426
}
426
427
if err := gpgSettings .LoadPublicKeyContent (); err != nil {
427
428
log .Error ("Error getting default signing key: %s %v" , gpgSettings .KeyID , err )
428
- }
429
- fingerprint , _ := asymkey_model . CalcFingerprint ( gpgSettings .PublicKeyContent )
430
- if commitVerification := verifySSHCommitVerification (c .Signature .Signature , c .Signature .Payload , & asymkey_model.PublicKey {
429
+ } else if fingerprint , err := asymkey_model . CalcFingerprint ( gpgSettings . PublicKeyContent ); err != nil {
430
+ log . Error ( "Error calculating the fingerprint public key: %s %v" , gpgSettings .KeyID , err )
431
+ } else if commitVerification := verifySSHCommitVerification (c .Signature .Signature , c .Signature .Payload , & asymkey_model.PublicKey {
431
432
Verified : true ,
432
433
Content : gpgSettings .PublicKeyContent ,
433
434
Fingerprint : fingerprint ,
@@ -444,18 +445,19 @@ func ParseCommitWithSSHSignature(ctx context.Context, c *git.Commit, committer *
444
445
}
445
446
}
446
447
448
+ // Covers ssh verification for the default SSH signing key specifed in the .gitconfig file in Git.HomePath setting
447
449
defaultGPGSettings , err := c .GetRepositoryDefaultPublicGPGKey (false )
448
450
if defaultGPGSettings .Format == git .KeyTypeSSH {
449
451
if err != nil {
450
- log .Error ("Error getting default public gpg key: %v" , err )
452
+ log .Error ("Error getting default public ssh key: %v" , err )
451
453
} else if defaultGPGSettings == nil {
452
454
log .Warn ("Unable to get defaultGPGSettings for unattached commit: %s" , c .ID .String ())
453
455
} else if defaultGPGSettings .Sign {
454
456
if err := defaultGPGSettings .LoadPublicKeyContent (); err != nil {
455
457
log .Error ("Error getting default signing key: %s %v" , defaultGPGSettings .KeyID , err )
456
- }
457
- fingerprint , _ := asymkey_model . CalcFingerprint ( defaultGPGSettings .PublicKeyContent )
458
- if commitVerification := verifySSHCommitVerification (c .Signature .Signature , c .Signature .Payload , & asymkey_model.PublicKey {
458
+ } else if fingerprint , err := asymkey_model . CalcFingerprint ( defaultGPGSettings . PublicKeyContent ); err != nil {
459
+ log . Error ( "Error calculating the fingerprint public key: %s %v" , defaultGPGSettings .KeyID , err )
460
+ } else if commitVerification := verifySSHCommitVerification (c .Signature .Signature , c .Signature .Payload , & asymkey_model.PublicKey {
459
461
Verified : true ,
460
462
Content : defaultGPGSettings .PublicKeyContent ,
461
463
Fingerprint : fingerprint ,
0 commit comments