mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-18 15:48:22 +00:00
Refactor monkey-patching of PrivateAddressCheck
(#24122)
This commit is contained in:
parent
aa947a143b
commit
630436ab2d
|
@ -273,7 +273,9 @@ class Request
|
||||||
|
|
||||||
def check_private_address(address, host)
|
def check_private_address(address, host)
|
||||||
addr = IPAddr.new(address.to_s)
|
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)
|
raise Mastodon::PrivateNetworkAddressError, host if PrivateAddressCheck.private_address?(addr)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -77,9 +77,3 @@ Rails.application.configure do
|
||||||
end
|
end
|
||||||
|
|
||||||
Redis.raise_deprecations = true
|
Redis.raise_deprecations = true
|
||||||
|
|
||||||
module PrivateAddressCheck
|
|
||||||
def self.private_address?(*)
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
Loading…
Reference in a new issue