Quell linter (false positive)

This commit is contained in:
Matthew Holt 2024-04-23 11:55:37 -06:00
parent 868af6a062
commit d404005339
No known key found for this signature in database
GPG Key ID: 2A349DD577D586A5
1 changed files with 3 additions and 0 deletions

View File

@ -181,12 +181,15 @@ func (hl HTTPLoader) makeClient(ctx caddy.Context) (*http.Client, error) {
if err != nil { if err != nil {
return nil, fmt.Errorf("getting server identity credentials: %v", err) return nil, fmt.Errorf("getting server identity credentials: %v", err)
} }
// See https://github.com/securego/gosec/issues/1054#issuecomment-2072235199
//nolint:gosec
tlsConfig = &tls.Config{Certificates: certs} tlsConfig = &tls.Config{Certificates: certs}
} else if hl.TLS.ClientCertificateFile != "" && hl.TLS.ClientCertificateKeyFile != "" { } else if hl.TLS.ClientCertificateFile != "" && hl.TLS.ClientCertificateKeyFile != "" {
cert, err := tls.LoadX509KeyPair(hl.TLS.ClientCertificateFile, hl.TLS.ClientCertificateKeyFile) cert, err := tls.LoadX509KeyPair(hl.TLS.ClientCertificateFile, hl.TLS.ClientCertificateKeyFile)
if err != nil { if err != nil {
return nil, err return nil, err
} }
//nolint:gosec
tlsConfig = &tls.Config{Certificates: []tls.Certificate{cert}} tlsConfig = &tls.Config{Certificates: []tls.Certificate{cert}}
} }