Module: HTTPX::Plugins::SsrfFilter::ConnectionMethods
- Defined in:
- lib/httpx/plugins/ssrf_filter.rb
Instance Method Summary collapse
Instance Method Details
#addresses=(addrs) ⇒ Object
144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/httpx/plugins/ssrf_filter.rb', line 144 def addresses=(addrs) addrs.reject! do |ipaddr| ipaddr = ipaddr.address next false if @options.safe_private_ranges&.any? { |r| r.include?(ipaddr) } SsrfFilter.unsafe_ip_address?(ipaddr) || @options.extra_unsafe_ranges&.any? { |r| r.include?(ipaddr) } end raise ServerSideRequestForgeryError, "#{@origin.host} has no public IP addresses" if addrs.empty? super end |
#initialize ⇒ Object
135 136 137 138 139 140 141 142 |
# File 'lib/httpx/plugins/ssrf_filter.rb', line 135 def initialize(*) begin super rescue ServerSideRequestForgeryError => e # may raise when IPs are passed as options via :addresses throw(:resolve_error, e) end end |