diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2023-03-16 04:33:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-16 04:33:38 +0100 |
commit | 630436ab2d84b5ed2334ad510cb9ad6253050ae5 (patch) | |
tree | b3b7dd8a52ea979ddd6863f55819674719d3a962 /app | |
parent | aa947a143b5bd84865bff2b24878d84f3d69b8b7 (diff) |
Refactor monkey-patching of `PrivateAddressCheck` (#24122)
Diffstat (limited to 'app')
-rw-r--r-- | app/lib/request.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/lib/request.rb b/app/lib/request.rb index 85716f999..4bde6fc91 100644 --- a/app/lib/request.rb +++ b/app/lib/request.rb @@ -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 |