fix(config): honour GLAB_PROXY for the proxy key

Description

The proxy config key lists GLAB_PROXY as its environment variable in internal/config/schema.go, but config.ResolveHostProxy read only the per-host proxy value. The variable never reached the API client.

resolveHostProxy now checks GLAB_PROXY first, through envValueForHost, the trusted-host gate it now shares with fileConfig.GetWithSource (proxy is not a credential key, so the env value applies to any host, as it does for ca_cert and client_cert). If it is not set, it falls back to the host's proxy value. It does not use the root-level fallback in GetWithSource, because a top-level proxy value has never applied to hosts and this MR does not change that.

The schema also listed a bare PROXY for this key. It came from the fallback that names a key's variable after the uppercased key, and it never routed any traffic, so this MR drops it instead of turning it on. Otherwise a PROXY set for another tool would pin every glab API call to that proxy and bypass NO_PROXY. docs/source/configuration.md and docs/source/config/_index.md are regenerated without it.

Related to #8635 (closed) Related to gitlab-org&24327

Stacks on main.

How has this been tested?

  • internal/api/client_proxy_test.go: a new subtest checks that setting GLAB_PROXY gives the API client that proxy. It failed before the fix (client.proxyURL was nil). The existing "configured proxy" subtest still passes, so a per-host value with no env variable set still works.
  • internal/config/host_proxy_test.go: GLAB_PROXY takes precedence over a per-host value, matching cfg.Get.
  • With a built binary, PROXY=http://127.0.0.1:9 glab api version succeeds, so PROXY is ignored. GLAB_PROXY=http://127.0.0.1:9 glab api version fails with proxyconnect tcp: dial tcp 127.0.0.1:9: connect: connection refused.
  • go test ./internal/config/... ./internal/api/... passes with and without PROXY set; golangci-lint run ./internal/config/... ./internal/api/... reports 0 issues.
Edited by Arpit Gogia

Merge request reports

Loading
Loading