Skip to content

Commit

Permalink
Convert proxy host value to nil if needed.
Browse files Browse the repository at this point in the history
`URI.parse` used to return `nil` for `host`, when parsing `unix:` URI.
However, it returens empty string since Ruby 3.2 / URI v0.12.0 for
security reasons:

https://hackerone.com/reports/156615
ruby/uri@81263c9
  • Loading branch information
voxik committed Jan 9, 2023
1 parent fe8ec7b commit 45152e8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/excon/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,8 @@ def setup_proxy
raise ArgumentError, "The `:ssl_proxy_headers` parameter should only be used with HTTPS requests."
end
if @data[:proxy][:scheme] == UNIX
# URI.parse might return empty string for security reasons.
@data[:proxy][:host] = nil if @data[:proxy][:host] == ""
if @data[:proxy][:host]
raise ArgumentError, "The `:host` parameter should not be set for `unix://` proxies.\n" +
"When supplying a `unix://` URI, it should start with `unix:/` or `unix:///`."
Expand Down

0 comments on commit 45152e8

Please sign in to comment.