Skip to content

Commit

Permalink
ensure cert != nil
Browse files Browse the repository at this point in the history
  • Loading branch information
petrutlucian94 committed Nov 26, 2024
1 parent 617e6dd commit 4dc023f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/k8s/pkg/utils/pki/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ func (check CertCheck) ValidateKeypair(certPEM string, keyPEM string) error {
}

func (check CertCheck) ValidateCert(cert *x509.Certificate) error {
if cert == nil {
return fmt.Errorf("no certificate specified")
}

if check.CN != "" && check.CN != cert.Subject.CommonName {
return fmt.Errorf("invalid certificate CN, expected: %s, actual: %s ",
check.CN, cert.Subject.CommonName)
Expand Down

0 comments on commit 4dc023f

Please sign in to comment.