Skip to content

Commit

Permalink
Check for https scheme before using inscure tls
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Jul 11, 2024
1 parent 5eb4986 commit 9244361
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/identity/b3.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func NewClient(baseURL, token string, caCert []byte, kc client.Reader) (*Client,
return nil, err
}
// use InsecureSkipVerify, if IP address is used for baseURL host
if ip := net.ParseIP(u.Hostname()); ip != nil {
if ip := net.ParseIP(u.Hostname()); ip != nil && u.Scheme == "https" {
customTransport := http.DefaultTransport.(*http.Transport).Clone()
customTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
c.client = &http.Client{Transport: customTransport}
Expand Down

0 comments on commit 9244361

Please sign in to comment.