Skip to content

fix: keep env proxies off SSRF base transport - #93

Open
lewtec-bot[bot] wants to merge 1 commit into
mainfrom
janitor/httpclient-no-proxy-ssrf
Open

fix: keep env proxies off SSRF base transport#93
lewtec-bot[bot] wants to merge 1 commit into
mainfrom
janitor/httpclient-no-proxy-ssrf

Conversation

@lewtec-bot

@lewtec-bot lewtec-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Problem

httpclient.NewTransport set Proxy: http.ProxyFromEnvironment. The CAS server builds its outbound client from that base and installs SSRF filtering on DialContext.

When HTTP_PROXY / HTTPS_PROXY is set, the transport dials the proxy, not the origin. The DialContext control only validates the proxy address, so a reachable proxy can fetch blocked ranges (loopback, link-local metadata, RFC1918, CGNAT, …) that the SSRF filter is meant to stop.

Change

  • Leave Proxy nil on NewTransport (SSRF / custom-Dial base)
  • Set ProxyFromEnvironment only in New() (CLI get/seed, library Fetcher default, handler nil-client fallback)
  • Tests: base has no proxy; New sets proxy without mutating a later NewTransport()

Behavior note: server origin/upstream fetches no longer follow env proxies. CLI/library clients still do.

Verify

mise exec -- go test ./... -count=1 -p 1

NewTransport is the shared dial/timeout base used by the CAS server when
installing DialContext IP filters. Honor HTTP(S)_PROXY only in New() for
CLI/library clients so a proxy hop cannot bypass origin IP checks.
@lewtec-bot
lewtec-bot Bot requested a review from lucasew July 24, 2026 22:11
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