Skip to content

feat: disable ssl verification, close #1024#1084

Merged
looplj merged 1 commit intorelease/v0.9.xfrom
dev-tmp
Mar 17, 2026
Merged

feat: disable ssl verification, close #1024#1084
looplj merged 1 commit intorelease/v0.9.xfrom
dev-tmp

Conversation

@looplj
Copy link
Copy Markdown
Owner

@looplj looplj commented Mar 17, 2026

No description provided.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request implements a new feature that allows disabling SSL certificate verification for outgoing HTTP requests. This is controlled by a new configuration setting, primarily intended for scenarios involving self-signed certificates in trusted environments. The change ensures that this setting is consistently applied across different parts of the application when HTTP clients are initialized, especially when proxy configurations are in use.

Highlights

  • New Configuration Option: Introduced a new configuration option DisableSSLVerify across the application, allowing users to disable SSL certificate verification for upstream HTTP requests.
  • Proxy Configuration Enhancement: The ProxyConfig structure now includes an InsecureSkipVerify field, which is utilized by the HTTP client to control SSL verification behavior.
  • Service Integration: The DisableSSLVerify setting is propagated and applied within various services and handlers, including Antigravity, ClaudeCode, Codex, Copilot, ChannelService, and ProviderQuotaService, ensuring consistent behavior for HTTP client creation.
Changelog
  • conf/conf.go
    • Added DisableSSLVerify field to the main Config struct.
    • Propagated the DisableSSLVerify value from APIServer config during loading.
    • Set a default value for server.disable_ssl_verify in setDefaults.
  • config.example.yml
    • Added disable_ssl_verify option to the example configuration with a warning about its usage.
  • internal/server/api/antigravity.go
    • Injected DisableSSLVerify into AntigravityHandlersParams and AntigravityHandlers.
    • Applied DisableSSLVerify to the proxy configuration when creating an HTTP client in the Exchange method.
  • internal/server/api/claudecode.go
    • Injected DisableSSLVerify into ClaudeCodeHandlersParams and ClaudeCodeHandlers.
    • Applied DisableSSLVerify to the proxy configuration when creating an HTTP client in the Exchange method.
  • internal/server/api/codex.go
    • Injected DisableSSLVerify into CodexHandlersParams and CodexHandlers.
    • Applied DisableSSLVerify to the proxy configuration when creating an HTTP client in the Exchange method.
  • internal/server/api/copilot.go
    • Injected DisableSSLVerify into CopilotHandlersParams and CopilotHandlers.
    • Applied DisableSSLVerify to the proxy configuration when creating an HTTP client in the StartOAuth and PollOAuth methods.
  • internal/server/biz/channel.go
    • Injected DisableSSLVerify into ChannelServiceParams and ChannelService.
    • Added disableSSLVerify field to ChannelService.
  • internal/server/biz/channel_llm.go
    • Refactored getProxyConfig to be a method of ChannelService.
    • Modified getProxyConfig to apply the global disableSSLVerify setting if not explicitly overridden by channel settings.
    • Updated buildChannelWithTransformer to use the new svc.getProxyConfig method.
  • internal/server/biz/model_fetcher.go
    • Updated FetchModels to apply disableSSLVerify when constructing a proxy configuration if channel settings do not provide one.
  • internal/server/biz/provider_quota.go
    • Injected DisableSSLVerify into ProviderQuotaServiceParams and ProviderQuotaService.
    • Passed the disableSSLVerify setting to the NewClaudeCodeQuotaChecker and NewCodexQuotaChecker constructors.
  • internal/server/biz/provider_quota/claudecode_checker.go
    • Added disableSSLVerify field to ClaudeCodeQuotaChecker and its constructor.
    • Applied disableSSLVerify when creating the HTTP client for quota checks.
  • internal/server/biz/provider_quota/codex_checker.go
    • Added disableSSLVerify field to CodexQuotaChecker and its constructor.
    • Applied disableSSLVerify when creating the HTTP client for quota checks.
  • internal/server/config.go
    • Added DisableSSLVerify field to the server.Config struct.
  • llm/httpclient/client.go
    • Imported the crypto/tls package.
    • Added logic to set InsecureSkipVerify on the http.Transport's TLSClientConfig if proxyConfig.InsecureSkipVerify is true.
  • llm/httpclient/proxy.go
    • Added InsecureSkipVerify boolean field to the ProxyConfig struct.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new DisableSSLVerify configuration option, allowing users to disable SSL certificate verification for upstream HTTP requests. The change involves adding this flag to the main configuration, server-specific configurations, and the proxy configuration struct. The NewHttpClientWithProxy function is updated to respect this flag by setting InsecureSkipVerify on the TLS client configuration. The DisableSSLVerify flag is then propagated and used across various API handlers (Antigravity, ClaudeCode, Codex, Copilot) and business logic services (ChannelService, ModelFetcher, ProviderQuotaService) to conditionally disable SSL verification when creating HTTP clients, especially when a proxy is involved. Review comments suggest refactoring to avoid modifying req.Proxy directly by creating a copy, ensuring consistent logic for disableSSLVerify in channel_llm.go, and reducing code duplication in model_fetcher.go and codex_checker.go by reusing or extracting common proxy configuration logic.

Comment on lines 217 to 220
if h.disableSSLVerify {
req.Proxy.InsecureSkipVerify = true
}
httpClient = httpclient.NewHttpClientWithProxy(req.Proxy)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To avoid side effects, it's better to create a copy of the proxy configuration instead of modifying the input request object req.Proxy directly. This improves code clarity and prevents unexpected behavior if the request object is used elsewhere.

        proxyConf := *req.Proxy
		if h.disableSSLVerify {
			proxyConf.InsecureSkipVerify = true
		}
		httpClient = httpclient.NewHttpClientWithProxy(&proxyConf)

Comment on lines 211 to 214
if h.disableSSLVerify {
req.Proxy.InsecureSkipVerify = true
}
httpClient = httpclient.NewHttpClientWithProxy(req.Proxy)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To avoid side effects, it's better to create a copy of the proxy configuration instead of modifying the input request object req.Proxy directly. This improves code clarity and prevents unexpected behavior if the request object is used elsewhere.

        proxyConf := *req.Proxy
		if h.disableSSLVerify {
			proxyConf.InsecureSkipVerify = true
		}
		httpClient = httpclient.NewHttpClientWithProxy(&proxyConf)

Comment on lines 210 to 213
if h.disableSSLVerify {
req.Proxy.InsecureSkipVerify = true
}
httpClient = httpclient.NewHttpClientWithProxy(req.Proxy)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To avoid side effects, it's better to create a copy of the proxy configuration instead of modifying the input request object req.Proxy directly. This improves code clarity and prevents unexpected behavior if the request object is used elsewhere.

        proxyConf := *req.Proxy
		if h.disableSSLVerify {
			proxyConf.InsecureSkipVerify = true
		}
		httpClient = httpclient.NewHttpClientWithProxy(&proxyConf)

Comment on lines 180 to 183
if h.disableSSLVerify {
req.Proxy.InsecureSkipVerify = true
}
httpClient = httpclient.NewHttpClientWithProxy(req.Proxy)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To avoid side effects, it's better to create a copy of the proxy configuration instead of modifying the input request object req.Proxy directly. This improves code clarity and prevents unexpected behavior if the request object is used elsewhere.

        proxyConf := *req.Proxy
		if h.disableSSLVerify {
			proxyConf.InsecureSkipVerify = true
		}
		httpClient = httpclient.NewHttpClientWithProxy(&proxyConf)

Comment on lines 303 to 306
if h.disableSSLVerify {
req.Proxy.InsecureSkipVerify = true
}
httpClient = httpclient.NewHttpClientWithProxy(req.Proxy)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To avoid side effects, it's better to create a copy of the proxy configuration instead of modifying the input request object req.Proxy directly. This improves code clarity and prevents unexpected behavior if the request object is used elsewhere.

        proxyConf := *req.Proxy
		if h.disableSSLVerify {
			proxyConf.InsecureSkipVerify = true
		}
		httpClient = httpclient.NewHttpClientWithProxy(&proxyConf)

Comment on lines +93 to +95
if svc.disableSSLVerify && !proxy.InsecureSkipVerify {
proxy.InsecureSkipVerify = true
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The logic here is slightly different from other places where disableSSLVerify is used. Here, you check !proxy.InsecureSkipVerify before setting it to true. In other files, it's an unconditional assignment. For consistency, it might be better to use the same logic everywhere. An unconditional assignment proxy.InsecureSkipVerify = svc.disableSSLVerify would be simpler and align with the behavior in other parts of the code, assuming the intent is for the global flag to always take precedence.

Suggested change
if svc.disableSSLVerify && !proxy.InsecureSkipVerify {
proxy.InsecureSkipVerify = true
}
if svc.disableSSLVerify {
proxy.InsecureSkipVerify = true
}

Comment on lines 265 to 271
proxyConfig = f.channelService.getProxyConfig(ch.Settings)
} else if f.channelService.disableSSLVerify {
proxyConfig = &httpclient.ProxyConfig{
Type: httpclient.ProxyTypeEnvironment,
InsecureSkipVerify: true,
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This logic for handling disableSSLVerify seems to be duplicated from internal/server/biz/channel_llm.go. Instead of reimplementing it here, you could reuse the getProxyConfig method from the channelService. This would reduce code duplication and ensure consistent behavior.

For example:

if ch.Settings != nil {
    proxyConfig = f.channelService.getProxyConfig(ch.Settings)
} else {
    // When ch.Settings is nil, getProxyConfig will correctly handle
    // the disableSSLVerify flag and return a default proxy config.
    proxyConfig = f.channelService.getProxyConfig(nil)
}

Comment on lines 85 to 97
proxyConfig := ch.Settings.Proxy
if c.disableSSLVerify {
proxyConfig.InsecureSkipVerify = true
}

wrappedClient := httpclient.NewHttpClientWithProxy(proxyConfig)
client = wrappedClient.GetNativeClient()
} else if c.disableSSLVerify {
wrappedClient := httpclient.NewHttpClientWithProxy(&httpclient.ProxyConfig{
Type: httpclient.ProxyTypeEnvironment,
InsecureSkipVerify: true,
})
client = wrappedClient.GetNativeClient()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This block has duplicated logic for creating a proxy-configured HTTP client. The logic for handling disableSSLVerify is also repeated. It would be beneficial to extract this into a shared function to ensure consistency and reduce code duplication. For instance, a helper could take the channel settings and the global disableSSLVerify flag and return a correctly configured *http.Client.

@looplj
Copy link
Copy Markdown
Owner Author

looplj commented Mar 17, 2026

@gemini-code-assist review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new configuration option, DisableSSLVerify, allowing users to disable SSL certificate verification for HTTP clients, primarily for self-signed certificates. The change involves adding this option to the main configuration, exposing it in example configurations and documentation, and integrating it into the application's HTTP client creation logic. Specifically, the httpclient.HttpClient now supports ClientOptions to configure TLS settings, and proxy-configured HTTP clients are updated to inherit these options from the default client. This ensures consistent SSL verification behavior across various API handlers, channel services, model fetchers, and provider quota checkers, centralizing HTTP client management and options inheritance throughout the system.

@looplj
Copy link
Copy Markdown
Owner Author

looplj commented Mar 17, 2026

@gemini-code-assist review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new configuration option to disable SSL verification, enhancing flexibility in environments with self-signed certificates. It modifies the configuration structure, adds a default value, and propagates the setting to HTTP clients. The changes span across configuration files, documentation, and internal server components to ensure consistent behavior. Additionally, comments related to nolint:gosec directives have been clarified with explicit reasons for suppression.

Comment on lines +60 to +64
if options.insecureSkipVerify {
transport.TLSClientConfig = &tls.Config{
InsecureSkipVerify: true, //nolint:gosec // User-configured option for self-signed certificates
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This change introduces the ability to skip TLS verification, which is useful for environments using self-signed certificates. However, disabling TLS verification can introduce security risks. Ensure users are aware of the implications and only enable this option in trusted environments. Consider adding a warning log when this option is enabled.

return Config{}, fmt.Errorf("failed to unmarshal config: %w", err)
}

config.DisableSSLVerify = config.APIServer.DisableSSLVerify
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The DisableSSLVerify configuration is being copied from APIServer to the root config. This might create confusion if the intention is to have separate controls. Consider if this propagation is truly necessary or if each component should manage its SSL verification independently.

Comment on lines +212 to +214
httpClient := h.httpClient
if req.Proxy != nil && req.Proxy.Type == httpclient.ProxyTypeURL && req.Proxy.URL != "" {
httpClient = httpclient.NewHttpClientWithProxy(req.Proxy)
httpClient = httpclient.NewHttpClientWithProxy(req.Proxy, h.httpClient.Options()...)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The Options() method is being called on the base httpClient and passed to the new client. This ensures that any existing configurations (like disabling SSL verification) are inherited by the new client. This is good for consistency.

Comment on lines +97 to +102
func (svc *ChannelService) getHttpClient(channelSettings *objects.ChannelSettings) *httpclient.HttpClient {
if channelSettings == nil || channelSettings.Proxy == nil {
return svc.httpClient
}

return httpclient.NewHttpClientWithProxy(channelSettings.Proxy, svc.httpClient.Options()...)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This function getHttpClient creates a new HTTP client with proxy support, inheriting TLS settings from the default client. This ensures that the new client respects the global DisableSSLVerify setting while also using the channel-specific proxy configuration.

Comment on lines +323 to +325
httpClient := f.httpClient
if proxyConfig != nil {
httpClient = httpclient.NewHttpClientWithProxy(proxyConfig)
} else {
httpClient = f.httpClient
httpClient = httpclient.NewHttpClientWithProxy(proxyConfig, f.httpClient.Options()...)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The Options() method is being called on the base httpClient and passed to the new client. This ensures that any existing configurations (like disabling SSL verification) are inherited by the new client. This is good for consistency.

Comment on lines +488 to +490
if p.httpClient == nil {
return nil, errors.New("http client is nil")
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Adding a nil check for the HTTP client before making a request is a good defensive programming practice to prevent potential panics.

Comment on lines +246 to +250
provider = NewTokenProvider(TokenProviderParams{
OAuthUrls: OAuthUrls{TokenUrl: "http://example.com/token"},
})
_, err = provider.refresh(context.Background(), &OAuthCredentials{RefreshToken: "refresh"})
require.EqualError(t, err, "http client is nil")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This test case validates that the refresh method returns an error when the HTTP client is nil, ensuring that the token provider handles this scenario gracefully.

Comment on lines +528 to +533
var opts []httpclient.ClientOption
if channel.HTTPClient != nil {
opts = channel.HTTPClient.Options()
}

customizedExecutor = httpclient.NewHttpClientWithProxy(p.state.Proxy, opts...)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The Options() method is being called on the base channel.HTTPClient and passed to the new client. This ensures that any existing configurations (like disabling SSL verification) are inherited by the new client. This is good for consistency.


if options.insecureSkipVerify {
transport.TLSClientConfig = &tls.Config{
InsecureSkipVerify: true, //nolint:gosec // User-configured option for self-signed certificates
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

This comment is a nolint directive to suppress a gosec warning. It's important to ensure that the reason for suppressing the warning is valid and documented. In this case, it's a user-configured option, which is acceptable, but the comment should explicitly state that.

Suggested change
InsecureSkipVerify: true, //nolint:gosec // User-configured option for self-signed certificates
InsecureSkipVerify: true, //nolint:gosec // User-configured option for self-signed certificates in trusted environments

} else {
transport.TLSClientConfig = transport.TLSClientConfig.Clone()
}
transport.TLSClientConfig.InsecureSkipVerify = true //nolint:gosec // User-configured option for self-signed certificates
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

This comment is a nolint directive to suppress a gosec warning. It's important to ensure that the reason for suppressing the warning is valid and documented. In this case, it's a user-configured option, which is acceptable, but the comment should explicitly state that.

Suggested change
transport.TLSClientConfig.InsecureSkipVerify = true //nolint:gosec // User-configured option for self-signed certificates
transport.TLSClientConfig.InsecureSkipVerify = true //nolint:gosec // User-configured option for self-signed certificates in trusted environments

@looplj looplj merged commit 43ae3a3 into release/v0.9.x Mar 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant