lib/gitlab/url_blocker.rb
# Validates the given url according to the constraints specified by arguments.
#
# ports - Raises error if the given URL port does is not between given ports.
# allow_localhost - Raises error if URL resolves to a localhost IP address and argument is true.
# allow_local_network - Raises error if URL resolves to a link-local address and argument is true.
# ascii_only - Raises error if URL has unicode characters and argument is true.
# enforce_user - Raises error if URL user doesn't start with alphanumeric characters and argument is true.
# enforce_sanitization - Raises error if URL includes any HTML/CSS/JS tags and argument is true.
#
# Returns an array with [<uri>, <original-hostname>].
# rubocop:disable Metrics/ParameterLists
Validates the given url according to the constraints specified by arguments.
ports - Raises error if the given URL port does is not between given ports.
allow_localhost - Raises error if URL resolves to a localhost IP address and argument is true.
allow_local_network - Raises error if URL resolves to a link-local address and argument is true.
ascii_only - Raises error if URL has unicode characters and argument is true.
enforce_user - Raises error if URL user doesn't start with alphanumeric characters and argument is true.
enforce_sanitization - Raises error if URL includes any HTML/CSS/JS tags and argument is true.

Returns an array with [, ].
Validates the given url according to the constraints specified by arguments . ports - Raises error if the given URL port does is not between given ports . allow_localhost - Raises error if URL resolves to a localhost IP address and argument is true . allow_local_network - Raises error if URL resolves to a link - local address and argument is true . ascii_only - Raises error if URL has unicode characters and argument is true . enforce_user - Raises error if URL user doesn ' t start with alphanumeric characters and argument is true . enforce_sanitization - Raises error if URL includes any HTML / CSS / JS tags and argument is true . Returns an array with [ ] .
def validate_local_request(address_info:, allow_localhost:, allow_local_network:)
        return if allow_local_network && allow_localhost
        unless allow_localhost
          validate_localhost(address_info)
          validate_loopback(address_info)
        end
        unless allow_local_network
          validate_local_network(address_info)
          validate_link_local(address_info)
        end
      end
def validate_local_request ( address_info : , allow_localhost : , allow_local_network : ) return if allow_local_network && allow_localhost unless allow_localhost validate_localhost ( address_info ) validate_loopback ( address_info ) end unless allow_local_network validate_local_network ( address_info ) validate_link_local ( address_info ) end end
Validates the given url according to the constraints specified by arguments.
Validates the given url according to the constraints specified by arguments .
address_info
<not_specific>
allow_localhost
<not_specific>
allow_local_network
<not_specific>