Akeyless provider ignores HTTP(S)_PROXY when CABundle/CAProvider is configured

Author: nils-dehnCreated Sep 15, 2026Updated Sep 22, 2026
Labelskind/bugarea/akeyless

Describe the bug

When a ClusterSecretStore/SecretStore using the akeyless provider sets caBundle (or caProvider), the provider silently stops honoring the HTTP_PROXY/HTTPS_PROXY/NO_PROXY environment variables, even though they are correctly set on the controller Deployment.

This happens because getAkeylessHTTPClient builds a brand-new http.Transport when a custom CA is configured, instead of cloning http.DefaultTransport. This could well be the same case in other providers or elsewhere in the codebase:

https://github.com/external-secrets/external-secrets/blob/v0.10.7/pkg/provider/akeyless/akeyless.go#L640-L657 (same code path present on main, providers/v1/akeyless/akeyless.go):

go
func (a *akeylessBase) getAkeylessHTTPClient(ctx context.Context, provider *esv1beta1.AkeylessProvider) (*http.Client, error) {
	client := &http.Client{Timeout: 30 * time.Second}
	if len(provider.CABundle) == 0 && provider.CAProvider == nil {
		return client, nil // Transport stays nil -> http.DefaultTransport is used, which sets Proxy: http.ProxyFromEnvironment
	}

	cert, err := utils.FetchCACertFromSource(ctx, utils.CreateCertOpts{...})
	...
	tlsConf := &tls.Config{
		RootCAs:    caCertPool,
		MinVersion: tls.VersionTLS12,
	}
	client.Transport = &http.Transport{TLSClientConfig: tlsConf} // BUG: Proxy field left nil, so no proxy is ever used
	return client, nil
}

Because the replacement http.Transport{TLSClientConfig: tlsConf} is constructed from scratch instead of http.DefaultTransport.(*http.Transport).Clone(), its Proxy field defaults to nil. Go's http.Transport does not fall back to proxy environment variables unless Proxy: http.ProxyFromEnvironment is explicitly set — a nil value means "never use a proxy," regardless of HTTP_PROXY/HTTPS_PROXY/NO_PROXY.

As a result, any environment where the Akeyless Gateway is only reachable through a corporate/egress HTTP proxy (a common requirement behind restrictive network policies, e.g. inside an Istio mesh with restricted egress) will fail to authenticate as soon as a caBundle/caProvider is configured on the SecretStore, because the request bypasses the proxy entirely and is sent directly, which then fails at the network layer (e.g. connection reset by peer) instead of reaching the Akeyless Gateway.

To Reproduce

Steps to reproduce the behavior:

  1. Deploy external-secrets with HTTP_PROXY/HTTPS_PROXY/NO_PROXY set via extraEnv, in an environment where the Akeyless Gateway endpoint is only reachable via that proxy (e.g. all other egress is blocked/dropped).
  2. Create a ClusterSecretStore for the akeyless provider that sets caBundle (or caProvider) to validate the Gateway's TLS certificate:
    yaml
    apiVersion: external-secrets.io/v1
    kind: ClusterSecretStore
    metadata:
      name: my-store
    spec:
      provider:
        akeyless:
          akeylessGWApiURL: "https://akeyless.example.internal/api/v2"
          authSecretRef:
            secretRef:
              accessID: { name: akeyless, key: accessId }
              accessType: { name: akeyless, key: accessType }
              accessTypeParam: { name: akeyless, key: accessTypeParam }
          caBundle: <base64 PEM of the internal CA that signed the Gateway cert>
  3. Create an ExternalSecret referencing that store and observe the Reconciler error in the controller logs:
    error processing spec.data[0] (key: ...), err: authentication failed: Post "https://akeyless.example.internal/api/v2/auth": read tcp <pod-ip>:<port>-><resolved-ip>:443: read: connection reset by peer
  4. Compare with a ClusterSecretStore that omits caBundle/caProvider (relying on the system trust store instead) — the proxy is honored and authentication succeeds.
  • Kubernetes version: 1.31 (GKE, Autopilot/Standard with Istio/ASM service mesh)
  • ESO version: v2.10.0 (chart external-secrets 2.10.0), also verified present in main (providers/v1/akeyless/akeyless.go)

Expected behavior

When caBundle/caProvider is configured on an akeyless SecretStore/ClusterSecretStore, the resulting http.Transport should still respect the process's HTTP_PROXY/HTTPS_PROXY/NO_PROXY environment variables (i.e. Proxy: http.ProxyFromEnvironment), consistent with the behavior when no custom CA is configured. This can be fixed by cloning http.DefaultTransport before overriding TLSClientConfig, e.g.:

go
transport := http.DefaultTransport.(*http.Transport).Clone()
transport.TLSClientConfig = tlsConf
client.Transport = transport

Screenshots

N/A

Additional context

  • This appears to affect every provider in the codebase that manually constructs &http.Transport{...} instead of cloning http.DefaultTransport when wiring up a custom tls.Config (a quick grep of pkg/provider / providers/v1 suggests this pattern is repeated elsewhere), so the same class of bug may exist beyond the Akeyless provider.
  • Workaround we're using in the meantime: don't set caBundle/caProvider on the ClusterSecretStore, and instead trust the internal CA at the pod's system-trust-store level via SSL_CERT_FILE/SSL_CERT_DIR env vars (supported natively by Go's crypto/x509 on Linux, no update-ca-certificates/shell required, which also makes it compatible with the distroless/static controller image).

Source: external-secrets/external-secrets