Public Class methods
new(*)
[show source]
# File lib/httpx/plugins/ssrf_filter.rb 135 def initialize(*) 136 begin 137 super 138 rescue ServerSideRequestForgeryError => e 139 # may raise when IPs are passed as options via :addresses 140 throw(:resolve_error, e) 141 end 142 end
Public Instance methods
addresses=(addrs)
[show source]
# File lib/httpx/plugins/ssrf_filter.rb 144 def addresses=(addrs) 145 addrs.reject! do |ipaddr| 146 ipaddr = ipaddr.address 147 next false if @options.safe_private_ranges&.any? { |r| r.include?(ipaddr) } 148 149 SsrfFilter.unsafe_ip_address?(ipaddr) || @options.extra_unsafe_ranges&.any? { |r| r.include?(ipaddr) } 150 end 151 152 raise ServerSideRequestForgeryError, "#{@origin.host} has no public IP addresses" if addrs.empty? 153 154 super 155 end