Skip to content

Commit

Permalink
fix: Provider is crashing when insecure=true
Browse files Browse the repository at this point in the history
  • Loading branch information
smutel committed Oct 20, 2023
1 parent eb3ee40 commit d8c7ef1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion netbox/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package netbox

import (
"context"
"crypto/tls"
"fmt"
"net/http"

Expand Down Expand Up @@ -227,7 +228,7 @@ func configureProvider(ctx context.Context, d *schema.ResourceData) (interface{}

t := runtimeclient.New(url, basepath, defaultScheme)
if insecure {
t.Transport.(*http.Transport).TLSClientConfig.InsecureSkipVerify = insecure
t.Transport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: insecure}

Check failure on line 231 in netbox/provider.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] netbox/provider.go#L231

G402: TLS InsecureSkipVerify set true. (gosec)
Raw output
netbox/provider.go:231:83: G402: TLS InsecureSkipVerify set true. (gosec)
		t.Transport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: insecure}
		                                                                                ^
}
t.DefaultAuthentication = runtimeclient.APIKeyAuth(authHeaderName, "header",
fmt.Sprintf(authHeaderFormat, token))
Expand Down

0 comments on commit d8c7ef1

Please sign in to comment.