Refactor monkey-patching of `PrivateAddressCheck` (#24122)

lolsob-rspec
Eugen Rochko 2023-03-16 04:33:38 +01:00 committed by GitHub
parent 8f638799ec
commit f0734513f4
2 changed files with 3 additions and 7 deletions

View File

@ -273,7 +273,9 @@ class Request
def check_private_address(address, host)
addr = IPAddr.new(address.to_s)
return if private_address_exceptions.any? { |range| range.include?(addr) }
return if Rails.env.development? || private_address_exceptions.any? { |range| range.include?(addr) }
raise Mastodon::PrivateNetworkAddressError, host if PrivateAddressCheck.private_address?(addr)
end

View File

@ -77,9 +77,3 @@ Rails.application.configure do
end
Redis.raise_deprecations = true
module PrivateAddressCheck
def self.private_address?(*)
false
end
end