Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ linters:
- G203
- G303
- G307
- G402
- G403
- G502
- G503
Expand Down
2 changes: 1 addition & 1 deletion central/auth/m2m/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func tlsConfigWithCustomCertPool() (*tls.Config, error) {
if err != nil {
return nil, err
}
return &tls.Config{RootCAs: certPool}, nil
return &tls.Config{RootCAs: certPool, MinVersion: tls.VersionTLS12}, nil
}

func systemCertPoolWithInjectedCAs() (*x509.CertPool, error) {
Expand Down
4 changes: 2 additions & 2 deletions central/credentialexpiry/service/service_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ func TestGetScannerV4CertExpiry(t *testing.T) {
errorExpiryFunc := genGetExpiryFunc(nil)

allScannerConfigs := map[mtls.Subject]*tls.Config{
mtls.ScannerV4IndexerSubject: {},
mtls.ScannerV4MatcherSubject: {},
mtls.ScannerV4IndexerSubject: {MinVersion: tls.VersionTLS12},
mtls.ScannerV4MatcherSubject: {MinVersion: tls.VersionTLS12},
}

noScannerConfigs := map[mtls.Subject]*tls.Config{}
Expand Down
2 changes: 1 addition & 1 deletion central/internal/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (s *HTTPServer) RunForever() {
httpServer := &http.Server{
Addr: s.Address,
Handler: s.mux,
TLSConfig: &tls.Config{
TLSConfig: &tls.Config{ //nolint:gosec // G402: MinVersion governed by TLS profile configuration
MinVersion: tlsprofile.MinVersion(),
CipherSuites: tlsprofile.CipherSuites(),
},
Expand Down
3 changes: 2 additions & 1 deletion central/notifiers/acscsemail/client_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ func transportWithAdditionalCA(caFile string) *http.Transport {

return &http.Transport{
TLSClientConfig: &tls.Config{
RootCAs: rootCAs,
RootCAs: rootCAs,
MinVersion: tls.VersionTLS12,
},
Proxy: proxy.FromConfig(),
}
Expand Down
1 change: 1 addition & 0 deletions central/notifiers/acscsemail/client_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ func TestTransportWithAdditonalCA(t *testing.T) {

tlsServ.TLS = &tls.Config{
Certificates: []tls.Certificate{generateTestServerCert(t, ca)},
MinVersion: tls.VersionTLS12,
}

tlsServ.StartTLS()
Expand Down
2 changes: 1 addition & 1 deletion central/notifiers/email/email.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ func (e *email) startTLSConn(dialCtx context.Context) (conn net.Conn, auth smtp.
}

func (e *email) tlsConfig() *tls.Config {
return &tls.Config{
return &tls.Config{ //nolint:gosec // G402: InsecureSkipVerify is user-configurable for email notifier
ServerName: e.smtpServer.host,
InsecureSkipVerify: e.config.GetSkipTLSVerify(),
}
Expand Down
2 changes: 1 addition & 1 deletion central/notifiers/generic/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func newGeneric(notifier *storage.Notifier, cryptoCodec cryptocodec.CryptoCodec,
client: &http.Client{
Timeout: timeout,
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
TLSClientConfig: &tls.Config{ //nolint:gosec // G402: InsecureSkipVerify is user-configurable for generic webhook
InsecureSkipVerify: conf.GetSkipTLSVerify(),
RootCAs: rootCAs,
},
Expand Down
2 changes: 1 addition & 1 deletion central/notifiers/splunk/splunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ func newSplunk(notifier *storage.Notifier, cryptoCodec cryptocodec.CryptoCodec,
healthEndpoint = url + splunkHECHealthEndpoint
}

tr := proxy.RoundTripper(proxy.WithTLSConfig(&tls.Config{InsecureSkipVerify: conf.GetInsecure()}))
tr := proxy.RoundTripper(proxy.WithTLSConfig(&tls.Config{InsecureSkipVerify: conf.GetInsecure()})) //#nosec G402 -- InsecureSkipVerify is user-configurable for Splunk
client := &http.Client{Transport: tr}

return &splunk{
Expand Down
2 changes: 1 addition & 1 deletion central/notifiers/sumologic/sumologic.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func newSumoLogic(notifier *storage.Notifier) (*sumologic, error) {
client: &http.Client{
Timeout: timeout,
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
TLSClientConfig: &tls.Config{ //nolint:gosec // G402: InsecureSkipVerify is user-configurable for SumoLogic
InsecureSkipVerify: sumoConf.GetSkipTLSVerify(),
},
Proxy: proxy.FromConfig(),
Expand Down
2 changes: 1 addition & 1 deletion central/notifiers/syslog/tcp_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (s *tcpSender) dialWithRetry() (net.Conn, error) {
tcpDialFunc := proxy.AwareDialContext
// If we're using TLS upgrade to a TLS dialFunc
if s.useTLS {
tlsConfig := &tls.Config{InsecureSkipVerify: s.skipTLSVerify}
tlsConfig := &tls.Config{InsecureSkipVerify: s.skipTLSVerify} //#nosec G402 -- InsecureSkipVerify is user-configurable for syslog
tcpDialFunc = func(ctx context.Context, addr string) (net.Conn, error) {
return proxy.AwareDialContextTLS(ctx, addr, tlsConfig)
}
Expand Down
2 changes: 1 addition & 1 deletion compliance/node/index/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func getDefaultClient() (*http.Client, error) {
}
defaultClient = &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
TLSClientConfig: &tls.Config{ //nolint:gosec // G402: in-cluster communication with mTLS certificates
// TODO: Should this always be set to true...?
InsecureSkipVerify: true,
Certificates: []tls.Certificate{clientCert},
Expand Down
1 change: 1 addition & 0 deletions compliance/node/index/indexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func (s *nodeIndexerSuite) createTestServer(tlsEnabled bool) *httptest.Server {
Certificates: []tls.Certificate{serverCert},
ClientAuth: tls.RequireAndVerifyClientCert,
ClientCAs: caCertPool,
MinVersion: tls.VersionTLS12,
}
server.StartTLS()
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/auth/authproviders/idputil/http_clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func NewHTTPClient() *http.Client {
func NewInsecureHTTPClient() *http.Client {
return &http.Client{
Transport: proxy.RoundTripper(
proxy.WithTLSConfig(&tls.Config{InsecureSkipVerify: true}),
proxy.WithTLSConfig(&tls.Config{InsecureSkipVerify: true}), //#nosec G402 -- intentional for IdP URLs with +insecure scheme suffix
),
Timeout: defaultTimeout,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func (c *openshiftConnector) validateOAuth2Endpoints(trustedCertPool *x509.CertP
return errors.Wrap(err, "creating unique endpoints")
}

tlsConfig := &tls.Config{RootCAs: trustedCertPool}
tlsConfig := &tls.Config{RootCAs: trustedCertPool, MinVersion: tls.VersionTLS12}

for _, endpoint := range endpoints {
if err := validateEndpoint(endpoint, tlsConfig); err != nil {
Expand Down Expand Up @@ -332,7 +332,7 @@ func (c *openshiftConnector) user(ctx context.Context, client *http.Client) (u u
func newHTTPClient(certPool *x509.CertPool) (*http.Client, error) {
return &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{RootCAs: certPool},
TLSClientConfig: &tls.Config{RootCAs: certPool, MinVersion: tls.VersionTLS12},
Proxy: proxy.FromConfig(),
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
Expand Down
1 change: 1 addition & 0 deletions pkg/clientconn/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ func TLSConfig(server mtls.Subject, opts TLSConfigOptions) (*tls.Config, error)
ServerName: serverName,
NextProtos: nextProtos,
RootCAs: opts.RootCAs,
MinVersion: tls.VersionTLS12,
}

if opts.UseClientCert != DontUseClientCert {
Expand Down
3 changes: 2 additions & 1 deletion pkg/grpc/endpoints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func (s *misdirectedRequestSuite) SetupSuite() {
cert := testutils.IssueSelfSignedCert(s.T(), "*.example.com", "*.example.com")
tlsConfig := &tls.Config{
Certificates: []tls.Certificate{cert},
MinVersion: tls.VersionTLS12,
}
s.tlsConfigurer = verifier.TLSConfigurerFunc(func() (*tls.Config, error) {
return tlsConfig, nil
Expand Down Expand Up @@ -216,7 +217,7 @@ func (s *misdirectedRequestSuite) TestAll() {
}

func makeRequestWithSNI(t *testing.T, endpoint net.Addr, targetURL, serverName string, useHTTP2 bool) *http.Response {
tlsConfig := &tls.Config{
tlsConfig := &tls.Config{ //#nosec G402 -- test code
InsecureSkipVerify: true,
ServerName: serverName,
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/grpc/marshaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (s *supressCveServiceTestErrorImpl) SuppressCVEs(_ context.Context, req *v1
func (a *MarshalerTest) TestDurationParsing() {
testPort := testutils.GetFreeTestPort()
url := fmt.Sprintf("https://localhost:%d/v1/nodecves/suppress", testPort)
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true} //#nosec G402 -- test code

api := newAPIForTest(a.T(), defaultConf(testPort))
grpcServiceHandler := &supressCveServiceTestErrorImpl{}
Expand Down
4 changes: 2 additions & 2 deletions pkg/grpc/requestinfo/requestinfo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"google.golang.org/grpc/peer"
)

var insecureTLSConfig = &tls.Config{InsecureSkipVerify: true}
var insecureTLSConfig = &tls.Config{InsecureSkipVerify: true} //#nosec G402 -- test code
var insecureSkipVerify = credentials.NewTLS(insecureTLSConfig)

const userAgentKey = "User-Agent"
Expand Down Expand Up @@ -90,7 +90,7 @@ func Test_gRPCGateway(t *testing.T) {
serviceInstance := &pingService{}

cert := testutils.IssueSelfSignedCert(t, "*.example.com", "*.example.com")
creds := credentials.NewTLS(&tls.Config{
creds := credentials.NewTLS(&tls.Config{ //#nosec G402 -- test code
InsecureSkipVerify: true,
Certificates: []tls.Certificate{cert},
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/grpc/server_ratelimit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (s *pingServiceTestImpl) Ping(context.Context, *v1.Empty) (*v1.PongMessage,
}

func (a *APIServerSuite) Test_Server_RateLimit_HTTP_Integration() {
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true} //#nosec G402 -- test code

tests := []struct {
name string
Expand Down
4 changes: 2 additions & 2 deletions pkg/grpc/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (a *APIServerSuite) Test_TwoTestsStartingAPIs() {
}

func (a *APIServerSuite) Test_CustomAPI() {
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true} //#nosec G402 -- test code

a.Run("fetch data from /test", func() {
testPort := testutils.GetFreeTestPort()
Expand Down Expand Up @@ -236,7 +236,7 @@ func (a *APIServerSuite) Test_GRPC_Server_Error_Response() {
url := fmt.Sprintf("https://localhost:%d/v1/ping", testPort)
jsonPayload := `{"code":3, "details":[], "error":"missing argument: invalid arguments", "message":"missing argument: invalid arguments"}`

http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true} //#nosec G402 -- test code

api := newAPIForTest(a.T(), defaultConf(testPort))
grpcServiceHandler := &pingServiceTestErrorImpl{}
Expand Down
2 changes: 1 addition & 1 deletion pkg/httputil/proxy/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func dialWithConnectProxy(ctx context.Context, proxyURL *url.URL, address string
}()

if proxyURL.Scheme == "https" {
rawConn = tls.Client(rawConn, &tls.Config{})
rawConn = tls.Client(rawConn, &tls.Config{MinVersion: tls.VersionTLS12})
}

// Note: the URL in the next line only matters for making sure we sent a correct `Host:` header.
Expand Down
1 change: 1 addition & 0 deletions pkg/httputil/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ func AwareDialContextTLS(ctx context.Context, address string, tlsClientConf *tls
if tlsClientConf == nil {
tlsClientConf = &tls.Config{
ServerName: host,
MinVersion: tls.VersionTLS12,
}
} else if tlsClientConf.ServerName == "" {
tlsClientConf = tlsClientConf.Clone()
Expand Down
3 changes: 2 additions & 1 deletion pkg/metrics/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ func fakeTLSConfig() (*tls.Config, error) {
Certificates: []tls.Certificate{cert},
ClientAuth: tls.RequireAndVerifyClientCert,
ClientCAs: certPool,
MinVersion: tls.VersionTLS12,
}
return tlsConfig, nil
}
Expand All @@ -184,7 +185,7 @@ func testClient() (*http.Client, error) {
}

tr := &http.Transport{
TLSClientConfig: &tls.Config{
TLSClientConfig: &tls.Config{ //#nosec G402 -- test code with self-signed certs
Certificates: []tls.Certificate{cert},
// We are using a self-signed certificate for testing.
InsecureSkipVerify: true,
Expand Down
2 changes: 1 addition & 1 deletion pkg/metrics/verifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestClientCertVerifier(t *testing.T) {
tlsVerifier := &clientCertVerifier{
subjectCN: c.subjectCN,
}
tlsConfig := &tls.Config{ClientCAs: caPool}
tlsConfig := &tls.Config{ClientCAs: caPool, MinVersion: tls.VersionTLS12}
err = tlsVerifier.VerifyPeerCertificate(certs[0], nil, tlsConfig)

if c.isError {
Expand Down
2 changes: 1 addition & 1 deletion pkg/mtls/verifier/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (NonCA) TLSConfig() (*tls.Config, error) {
// When these are unset the compiled-in defaults are used (TLS 1.2 with
// AES-256-GCM preferred over AES-128-GCM).
func DefaultTLSServerConfig(certPool *x509.CertPool, certs []tls.Certificate) *tls.Config {
cfg := &tls.Config{
cfg := &tls.Config{ //nolint:gosec // G402: MinVersion governed by TLS profile configuration
MinVersion: tlsprofile.MinVersion(),
PreferServerCipherSuites: true,
CipherSuites: tlsprofile.CipherSuites(),
Expand Down
2 changes: 1 addition & 1 deletion pkg/registries/docker/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func DefaultTransport(cfg *Config) registry.Transport {
)
if cfg.Insecure {
transport = proxy.RoundTripper(
proxy.WithTLSConfig(&tls.Config{InsecureSkipVerify: true}),
proxy.WithTLSConfig(&tls.Config{InsecureSkipVerify: true}), //#nosec G402 -- InsecureSkipVerify is user-configurable for registry
proxy.WithDialTimeout(env.RegistryDialerTimeout.DurationSetting()),
proxy.WithResponseHeaderTimeout(env.RegistryResponseTimeout.DurationSetting()),
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/registries/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func (r *Registry) buildTransport() http.RoundTripper {
)
if r.cfg.Insecure {
transport = proxy.RoundTripper(
proxy.WithTLSConfig(&tls.Config{InsecureSkipVerify: true}),
proxy.WithTLSConfig(&tls.Config{InsecureSkipVerify: true}), //#nosec G402 -- InsecureSkipVerify is user-configurable for registry
proxy.WithDialTimeout(env.RegistryDialerTimeout.DurationSetting()),
proxy.WithResponseHeaderTimeout(env.RegistryResponseTimeout.DurationSetting()),
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/scanners/clair/clair.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func newScanner(integration *storage.ImageIntegration) (*clair, error) {
client := &http.Client{
Timeout: requestTimeout,
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
TLSClientConfig: &tls.Config{ //nolint:gosec // G402: InsecureSkipVerify is user-configurable for Clair scanner
InsecureSkipVerify: config.GetInsecure(),
},
Proxy: proxy.FromConfig(),
Expand Down
2 changes: 1 addition & 1 deletion pkg/scanners/clairv4/clairv4.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func newScanner(integration *storage.ImageIntegration, activeRegistries registri
// No need to specify a context for HTTP requests, as the client specifies a request timeout.
Timeout: requestTimeout,
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
TLSClientConfig: &tls.Config{ //nolint:gosec // G402: InsecureSkipVerify is user-configurable for ClairV4 scanner
InsecureSkipVerify: cfg.GetInsecure(),
},
Proxy: proxy.FromConfig(),
Expand Down
2 changes: 1 addition & 1 deletion pkg/scanners/quay/quay.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func newScanner(protoImageIntegration *storage.ImageIntegration) (*quay, error)
client := &http.Client{
Timeout: requestTimeout,
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
TLSClientConfig: &tls.Config{ //nolint:gosec // G402: InsecureSkipVerify is user-configurable for Quay scanner
InsecureSkipVerify: config.GetInsecure(),
},
Proxy: proxy.FromConfig(),
Expand Down
2 changes: 1 addition & 1 deletion pkg/signatures/cosign_sig_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var insecureDefaultTransport *http.Transport

func init() {
insecureDefaultTransport = gcrRemote.DefaultTransport.(*http.Transport).Clone()
insecureDefaultTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
insecureDefaultTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} //#nosec G402 -- intentional for insecure registry connections
}

// FetchSignatures implements the SignatureFetcher interface.
Expand Down
2 changes: 1 addition & 1 deletion pkg/testutils/centralgrpc/connect_to_central.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func grpcConnectionToCentral(t testutils.T, optsFuncs ...func(options *clientcon
// the hostname and scheme part of the URL may be omitted.
func HTTPClientForCentral(t testutils.T) *http.Client {
baseTransport := &http.Transport{
TLSClientConfig: &tls.Config{
TLSClientConfig: &tls.Config{ //nolint:gosec // G402: test helper, skip TLS verification
InsecureSkipVerify: true,
},
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/tlsutils/dial_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestDialContextError(t *testing.T) {
InnerLogger: zap.New(observedZapCore).Sugar(),
}

_, err := DialContext(context.Background(), "tcp", dialAddr, &tls.Config{})
_, err := DialContext(context.Background(), "tcp", dialAddr, &tls.Config{MinVersion: tls.VersionTLS12})

assert.NotContains(t, err.Error(), "127.0.0.1")
assert.NotContains(t, err.Error(), "10001")
Expand Down
2 changes: 1 addition & 1 deletion roxctl/central/cert/cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (cmd *centralCertCommand) certs() error {

// Connect to the given server. We're not expecting the endpoint be
// trusted, but force the user to use insecure mode if needed.
config := tls.Config{
config := tls.Config{ //nolint:gosec // G402: InsecureSkipVerify is user-configurable
InsecureSkipVerify: skipTLSValidation(),
ServerName: serverName,
}
Expand Down
2 changes: 1 addition & 1 deletion scale/tests/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func asyncWithWaitGroup(function func() error, wg *concurrency.WaitGroup) {
func getHTTPClient() *http.Client {
return &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
TLSClientConfig: &tls.Config{ //#nosec G402 -- test code
InsecureSkipVerify: true,
},
},
Expand Down
2 changes: 1 addition & 1 deletion scanner/cmd/scannerctl/scale.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func scaleCmd(ctx context.Context) *cobra.Command {

httpClient := &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, //#nosec G402 -- scale testing tool, not production code
},
}

Expand Down
4 changes: 2 additions & 2 deletions scanner/indexer/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ func proxiedRemoteTransport(insecure bool) http.RoundTripper {
}()
if insecure {
if tr.TLSClientConfig == nil {
tr.TLSClientConfig = &tls.Config{}
tr.TLSClientConfig = &tls.Config{MinVersion: tls.VersionTLS12}
}
tr.TLSClientConfig.InsecureSkipVerify = true
tr.TLSClientConfig.InsecureSkipVerify = true //#nosec G402 -- intentional for insecure registry connections
}
return tr
}
Expand Down
4 changes: 2 additions & 2 deletions scanner/internal/httputil/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ type insecureCapableTransport struct {
func NewInsecureCapableTransport(transport *http.Transport) http.RoundTripper {
insecure := transport.Clone()
if insecure.TLSClientConfig == nil {
insecure.TLSClientConfig = &tls.Config{}
insecure.TLSClientConfig = &tls.Config{MinVersion: tls.VersionTLS12}
}
insecure.TLSClientConfig.InsecureSkipVerify = true
insecure.TLSClientConfig.InsecureSkipVerify = true //#nosec G402 -- intentional for insecure-capable transport

return &insecureCapableTransport{
transport: transport,
Expand Down
Loading