Repository navigation
Fix doubled scheme in the custom http tool's recording proxy URL - #187
Merged
Merged
Conversation
ProxyAddr returns a URL that already carries a scheme (the recording proxy and the validated global proxy), but httpProxyTransport wrote "http://" before it, so use_recording_proxy produced http://http://... proxyURLString now adds http:// only to a bare host:port, for both the operator proxy and ProxyAddr. httpToolTransport falls back to a fresh http.Transport when http.DefaultTransport is not an *http.Transport.
Merged
usinfosec
pushed a commit
to usinfosec/ARTEX
that referenced
this pull request
Nov 17, 2026
fix(notify): 汇总模式退化、目的地留空误判、SMTP 缺 SSRF 守卫
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
server/customtool.go: new helperproxyURLString(s): trims the value; an empty value or one that already contains://is returned as is, a barehost:portgetshttp://.httpProxyTransportuses it for the operator proxy (spec.Proxy) and fors.m.ProxyAddr()(use_recording_proxy).httpToolTransport: whenhttp.DefaultTransportis not an*http.Transport, it clones a fresh&http.Transport{}instead of panicking on the type assertion.Why
httpProxyTransportbuilt the recording-proxy URL as"http://" + s.m.ProxyAddr(), butProxyAddr()already returns a URL with a scheme:traffic.ProxyAddr()returnshttp://127.0.0.1:<port>/http://<addr>(traffic/traffic.go:305-310), and with capture off it returns the global proxy, which is validated with a scheme. So a custom http tool withuse_recording_proxy: truewas sent to a proxy URL that does not work.Proxy URL before / after
use_recording_proxy,ProxyAddr()=http://127.0.0.1:3128http://http://127.0.0.1:3128(request fails:proxyconnect tcp: dial tcp: lookup http ...: no such host)http://127.0.0.1:3128proxy=http://10.0.0.5:8080http://10.0.0.5:8080http://10.0.0.5:8080proxy=10.0.0.5:8080(bare)10.0.0.5:8080(no scheme)http://10.0.0.5:8080Tests
TestBypass_CustomHTTPProxyPeerNotPinned:g.m.globalProxyis nowproxy.URL(with a scheme, as in production); the old comment that said the address was given without a scheme is fixed. On the code before this change it fails:use_recording_proxy: error=true out="request failed: Get \"http://api.example.com:45495/bypass\": proxyconnect tcp: dial tcp: lookup http on 172.22.0.1:53: no such host"; it passes after.TestHTTPProxyTransportProxyScheme(no database): recording proxy with a global proxy carrying a scheme, operator proxy with a scheme, operator proxy as barehost:port; asserts the transport'sProxy(req)URL. Before the fix the first case returnedhttp://http://127.0.0.1:3128.TestHTTPToolTransportDefaultTransportNotStd(no database, not parallel): replaceshttp.DefaultTransportwith a RoundTripper that delegates to the original, callshttpToolTransportin a gated scope, asserts a non-nil transport withDialContextset, and restores it. Before the fix it panicked on the type assertion.Run locally with Go 1.26.10 (linux/amd64) against a throwaway PostgreSQL 16 container:
go build ./...: okgo vet ./server/: okgo test -count=1 ./server/ -run 'TestHTTPProxyTransport|TestBypass_CustomHTTPProxyPeerNotPinned|TestCustomHTTP': okgo test -count=1 -p 1 ./...on a fresh database: all packages okNot verified
ProxyAddr()and the unit test../serverwas not run under-race(CI does not run it there either). The DefaultTransport test swaps a package global; it is sequential and the replacement delegates to the original transport, but it is a formal write to a global that leftover goroutines of earlier tests could read.