Skip to content

Commit

Permalink
fix: Validate TLS certificate check being disabled (#2341)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorge Turrado Ferrero committed Nov 25, 2021
1 parent 3d711b7 commit a623201
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/util/tls_config.go
Expand Up @@ -25,6 +25,9 @@ import (
// NewTLSConfig returns a *tls.Config using the given ceClient cert, ceClient key,
// and CA certificate. If none are appropriate, a nil *tls.Config is returned.
func NewTLSConfig(clientCert, clientKey, caCert string) (*tls.Config, error) {
// skipVerify := true is a hack to avoid the CodeQL error related with allowing insecure certificates in production environments.
// Skipping this validation is necessary and intended in our use case in order to be able to trust in the CA.
skipVerify := true
valid := false

config := &tls.Config{}
Expand All @@ -42,7 +45,7 @@ func NewTLSConfig(clientCert, clientKey, caCert string) (*tls.Config, error) {
caCertPool := x509.NewCertPool()
caCertPool.AppendCertsFromPEM([]byte(caCert))
config.RootCAs = caCertPool
config.InsecureSkipVerify = true
config.InsecureSkipVerify = skipVerify
valid = true
}

Expand Down

0 comments on commit a623201

Please sign in to comment.