You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fetch.WithAllowPrivateHosts (added in #51, released in v0.7.0) stores an allowlist that only the fetcher's default DialContext consults via gateOptions. When a caller passes fetch.WithHTTPClient, that default transport is replaced and the allowlist is never read.
git-pkgs/proxy builds its own safehttp.New(nil, safehttp.Options{}) client so it can wrap the transport with auth and access-log layers before passing it to fetch.NewFetcher(fetch.WithHTTPClient(...)). Under that composition there's no way to allowlist a private-network upstream: safehttp.Options only offers the blanket AllowPrivate / AllowLoopback booleans, and fetch.WithAllowPrivateHosts has no effect on an injected client. The metadata http.Client the proxy uses directly (outside the fetcher) has the same limitation.
Suggested change: add AllowPrivateHosts []string (matched via the existing normalizeHost) to safehttp.Options and have the safehttp DialContext apply AllowPrivate for those hosts only. fetch.WithAllowPrivateHosts can then set it on the default client's options rather than keeping a separate map, so both the default and injected-client paths behave the same.
Activity