Skip to content

Commit

Permalink
Do not connect to unix-schemed URIs through SOCKS proxy (#366)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjirewis authored Oct 9, 2024
1 parent ef097c7 commit 77ed10a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rpc/dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ func dialDirectGRPC(ctx context.Context, address string, dOpts dialOptions, logg
// Use SOCKS proxy from environment as gRPC proxy dialer. Do not use
// if trying to connect to a local address.
if proxyAddr := os.Getenv(SocksProxyEnvVar); proxyAddr != "" &&
!(strings.HasPrefix(address, "[::]") || strings.HasPrefix(address, "localhost")) {
!(strings.HasPrefix(address, "[::]") || strings.HasPrefix(address, "localhost") ||
strings.HasPrefix(address, "unix")) {
dialer, err := proxy.SOCKS5("tcp", proxyAddr, nil, proxy.Direct)
if err != nil {
return nil, false, fmt.Errorf("error creating SOCKS proxy dialer to address %q from environment: %w",
Expand Down

0 comments on commit 77ed10a

Please sign in to comment.