Skip to content

Commit

Permalink
fix: keep tls config structurues of http and websockets separate, uns…
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-kupries committed Jan 26, 2023
1 parent 4f3665f commit 8e3f3df
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/auth/certs.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func ExtendLocalTrust(certs string) {
}

http.DefaultTransport.(*http.Transport).TLSClientConfig = config
websocket.DefaultDialer.TLSClientConfig = config
websocket.DefaultDialer.TLSClientConfig = config.Clone()

// See https://github.com/gorilla/websocket/issues/601 for
// what this is a work around for.
Expand Down
4 changes: 1 addition & 3 deletions internal/cli/settings/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,11 @@ func LoadFrom(file string) (*Settings, error) {
}

http.DefaultTransport.(*http.Transport).TLSClientConfig = tlsInsecure
websocket.DefaultDialer.TLSClientConfig = tlsInsecure
} else {
// nolint:gosec // Controlled by user option
http.DefaultTransport.(*http.Transport).TLSClientConfig.InsecureSkipVerify = true
// websocket.DefaultDialer.TLSClientConfig refers to the same structure,
// and the assignment has modified it also.
}
websocket.DefaultDialer.TLSClientConfig = http.DefaultTransport.(*http.Transport).TLSClientConfig.Clone()
}

if !cfg.Colors || viper.GetBool("no-colors") {
Expand Down

0 comments on commit 8e3f3df

Please sign in to comment.