@@ -125,7 +125,7 @@ func ParseCommitWithSignature(ctx context.Context, c *git.Commit) *CommitVerific
125125
126126 // If this a SSH signature handle it differently
127127 if strings .HasPrefix (c .Signature .Signature , "-----BEGIN SSH SIGNATURE-----" ) {
128- return ParseCommitWithSSHSignature (c , committer )
128+ return ParseCommitWithSSHSignature (ctx , c , committer )
129129 }
130130
131131 // Parsing signature
@@ -150,6 +150,7 @@ func ParseCommitWithSignature(ctx context.Context, c *git.Commit) *CommitVerific
150150
151151 // First check if the sig has a keyID and if so just look at that
152152 if commitVerification := hashAndVerifyForKeyID (
153+ ctx ,
153154 sig ,
154155 c .Signature .Payload ,
155156 committer ,
@@ -165,7 +166,7 @@ func ParseCommitWithSignature(ctx context.Context, c *git.Commit) *CommitVerific
165166
166167 // Now try to associate the signature with the committer, if present
167168 if committer .ID != 0 {
168- keys , err := ListGPGKeys (db . DefaultContext , committer .ID , db.ListOptions {})
169+ keys , err := ListGPGKeys (ctx , committer .ID , db.ListOptions {})
169170 if err != nil { // Skipping failed to get gpg keys of user
170171 log .Error ("ListGPGKeys: %v" , err )
171172 return & CommitVerification {
@@ -175,7 +176,7 @@ func ParseCommitWithSignature(ctx context.Context, c *git.Commit) *CommitVerific
175176 }
176177 }
177178
178- committerEmailAddresses , _ := user_model .GetEmailAddresses (committer .ID )
179+ committerEmailAddresses , _ := user_model .GetEmailAddresses (ctx , committer .ID )
179180 activated := false
180181 for _ , e := range committerEmailAddresses {
181182 if e .IsActivated && strings .EqualFold (e .Email , c .Committer .Email ) {
@@ -222,7 +223,7 @@ func ParseCommitWithSignature(ctx context.Context, c *git.Commit) *CommitVerific
222223 }
223224 if err := gpgSettings .LoadPublicKeyContent (); err != nil {
224225 log .Error ("Error getting default signing key: %s %v" , gpgSettings .KeyID , err )
225- } else if commitVerification := verifyWithGPGSettings (& gpgSettings , sig , c .Signature .Payload , committer , keyID ); commitVerification != nil {
226+ } else if commitVerification := verifyWithGPGSettings (ctx , & gpgSettings , sig , c .Signature .Payload , committer , keyID ); commitVerification != nil {
226227 if commitVerification .Reason == BadSignature {
227228 defaultReason = BadSignature
228229 } else {
@@ -237,7 +238,7 @@ func ParseCommitWithSignature(ctx context.Context, c *git.Commit) *CommitVerific
237238 } else if defaultGPGSettings == nil {
238239 log .Warn ("Unable to get defaultGPGSettings for unattached commit: %s" , c .ID .String ())
239240 } else if defaultGPGSettings .Sign {
240- if commitVerification := verifyWithGPGSettings (defaultGPGSettings , sig , c .Signature .Payload , committer , keyID ); commitVerification != nil {
241+ if commitVerification := verifyWithGPGSettings (ctx , defaultGPGSettings , sig , c .Signature .Payload , committer , keyID ); commitVerification != nil {
241242 if commitVerification .Reason == BadSignature {
242243 defaultReason = BadSignature
243244 } else {
@@ -257,9 +258,9 @@ func ParseCommitWithSignature(ctx context.Context, c *git.Commit) *CommitVerific
257258 }
258259}
259260
260- func verifyWithGPGSettings (gpgSettings * git.GPGSettings , sig * packet.Signature , payload string , committer * user_model.User , keyID string ) * CommitVerification {
261+ func verifyWithGPGSettings (ctx context. Context , gpgSettings * git.GPGSettings , sig * packet.Signature , payload string , committer * user_model.User , keyID string ) * CommitVerification {
261262 // First try to find the key in the db
262- if commitVerification := hashAndVerifyForKeyID (sig , payload , committer , gpgSettings .KeyID , gpgSettings .Name , gpgSettings .Email ); commitVerification != nil {
263+ if commitVerification := hashAndVerifyForKeyID (ctx , sig , payload , committer , gpgSettings .KeyID , gpgSettings .Name , gpgSettings .Email ); commitVerification != nil {
263264 return commitVerification
264265 }
265266
@@ -387,7 +388,7 @@ func hashAndVerifyWithSubKeysCommitVerification(sig *packet.Signature, payload s
387388 return nil
388389}
389390
390- func hashAndVerifyForKeyID (sig * packet.Signature , payload string , committer * user_model.User , keyID , name , email string ) * CommitVerification {
391+ func hashAndVerifyForKeyID (ctx context. Context , sig * packet.Signature , payload string , committer * user_model.User , keyID , name , email string ) * CommitVerification {
391392 if keyID == "" {
392393 return nil
393394 }
@@ -417,7 +418,7 @@ func hashAndVerifyForKeyID(sig *packet.Signature, payload string, committer *use
417418 }
418419 }
419420
420- activated , email := checkKeyEmails (email , append ([]* GPGKey {key }, primaryKeys ... )... )
421+ activated , email := checkKeyEmails (ctx , email , append ([]* GPGKey {key }, primaryKeys ... )... )
421422 if ! activated {
422423 continue
423424 }
@@ -427,7 +428,7 @@ func hashAndVerifyForKeyID(sig *packet.Signature, payload string, committer *use
427428 Email : email ,
428429 }
429430 if key .OwnerID != 0 {
430- owner , err := user_model .GetUserByID (db . DefaultContext , key .OwnerID )
431+ owner , err := user_model .GetUserByID (ctx , key .OwnerID )
431432 if err == nil {
432433 signer = owner
433434 } else if ! user_model .IsErrUserNotExist (err ) {
0 commit comments