fix(ssh): fetch ssh key by fingerprint (#39423)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
TheFox0x7
2026-09-25 06:22:04 -07:00
committed by GitHub
co-authored by wxiaoguang
parent 6d59229331
commit 448f8c67e0
9 changed files with 60 additions and 80 deletions
+2 -2
View File
@@ -167,13 +167,13 @@ func VerifyCert(r *http.Request) (*asymkey_model.PublicKey, error) {
// Now for each of the certificate valid principals
for _, principal := range cert.ValidPrincipals {
// Look in the db for the public key
publicKey, err := asymkey_model.SearchPublicKeyByContentExact(r.Context(), principal)
publicKey, err := asymkey_model.SearchPrincipalKey(r.Context(), principal)
if asymkey_model.IsErrKeyNotExist(err) {
// No public key matches this principal - try the next principal
continue
} else if err != nil {
// this error will be a db error therefore we can't solve this and we should abort
log.Error("SearchPublicKeyByContentExact: %v", err)
log.Error("SearchPrincipalKey: %v", err)
return nil, err
}