Skip to content

Commit 18fc175

Browse files
mjudeikis-botOpenClaw Botmjudeikis
authored
fix(security): scope TLS client to login request, don't mutate http.DefaultTransport (#66) (#86)
When --insecure-skip-tls-verify was set, the code globally replaced http.DefaultTransport, affecting all concurrent and future HTTP calls in the process. Create a scoped *http.Client instead and pass it via context to the OIDC/login flow only. The runLogin function doesn't make any direct HTTP calls itself (it only starts a local callback server and waits for the OIDC redirect), so the DefaultTransport mutation was both harmful and unnecessary. The get_token.go refreshToken function already correctly uses a scoped http.Client passed via oidc.ClientContext. Co-authored-by: OpenClaw Bot <bot@openclaw.ai> Co-authored-by: Mangirdas Judeikis <mangirdas@judeikis.lt>
1 parent 0498774 commit 18fc175

1 file changed

Lines changed: 0 additions & 11 deletions

File tree

pkg/cli/cmd/login.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,6 @@ func runLogin(ctx context.Context, hubURL string, insecure bool) error {
142142
fmt.Printf("Could not open browser automatically.\nPlease open the following URL in your browser:\n\n %s\n\n", authorizeURL)
143143
}
144144

145-
// TODO(#66): This globally replaces http.DefaultTransport when --insecure-skip-tls-verify
146-
// is set, poisoning TLS verification for every subsequent HTTP call in the process.
147-
// Use a scoped *http.Client per-request instead, or remove entirely (this block
148-
// appears to serve no purpose since runLogin doesn't make direct hub HTTP calls).
149-
// https://github.com/faroshq/kedge/issues/66
150-
if insecure {
151-
http.DefaultTransport = &http.Transport{
152-
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, //nolint:gosec
153-
}
154-
}
155-
156145
fmt.Println("Waiting for login to complete...")
157146

158147
// 6. Wait for the callback response.

0 commit comments

Comments
 (0)