diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /lib/gitlab/url_blockers | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'lib/gitlab/url_blockers')
-rw-r--r-- | lib/gitlab/url_blockers/domain_allowlist_entry.rb (renamed from lib/gitlab/url_blockers/domain_whitelist_entry.rb) | 2 | ||||
-rw-r--r-- | lib/gitlab/url_blockers/ip_allowlist_entry.rb (renamed from lib/gitlab/url_blockers/ip_whitelist_entry.rb) | 2 | ||||
-rw-r--r-- | lib/gitlab/url_blockers/url_allowlist.rb (renamed from lib/gitlab/url_blockers/url_whitelist.rb) | 24 |
3 files changed, 13 insertions, 15 deletions
diff --git a/lib/gitlab/url_blockers/domain_whitelist_entry.rb b/lib/gitlab/url_blockers/domain_allowlist_entry.rb index b94e8ee3f69..b65bd9e1a92 100644 --- a/lib/gitlab/url_blockers/domain_whitelist_entry.rb +++ b/lib/gitlab/url_blockers/domain_allowlist_entry.rb @@ -2,7 +2,7 @@ module Gitlab module UrlBlockers - class DomainWhitelistEntry + class DomainAllowlistEntry attr_reader :domain, :port def initialize(domain, port: nil) diff --git a/lib/gitlab/url_blockers/ip_whitelist_entry.rb b/lib/gitlab/url_blockers/ip_allowlist_entry.rb index 88c76574d3d..b293afe166c 100644 --- a/lib/gitlab/url_blockers/ip_whitelist_entry.rb +++ b/lib/gitlab/url_blockers/ip_allowlist_entry.rb @@ -2,7 +2,7 @@ module Gitlab module UrlBlockers - class IpWhitelistEntry + class IpAllowlistEntry attr_reader :ip, :port # Argument ip should be an IPAddr object diff --git a/lib/gitlab/url_blockers/url_whitelist.rb b/lib/gitlab/url_blockers/url_allowlist.rb index 59f74dde7fc..60238bea75a 100644 --- a/lib/gitlab/url_blockers/url_whitelist.rb +++ b/lib/gitlab/url_blockers/url_allowlist.rb @@ -2,43 +2,41 @@ module Gitlab module UrlBlockers - class UrlWhitelist + class UrlAllowlist class << self - def ip_whitelisted?(ip_string, port: nil) + def ip_allowed?(ip_string, port: nil) return false if ip_string.blank? - ip_whitelist, _ = outbound_local_requests_whitelist_arrays + ip_allowlist, _ = outbound_local_requests_allowlist_arrays ip_obj = Gitlab::Utils.string_to_ip_object(ip_string) - ip_whitelist.any? do |ip_whitelist_entry| - ip_whitelist_entry.match?(ip_obj, port) + ip_allowlist.any? do |ip_allowlist_entry| + ip_allowlist_entry.match?(ip_obj, port) end end - def domain_whitelisted?(domain_string, port: nil) + def domain_allowed?(domain_string, port: nil) return false if domain_string.blank? - _, domain_whitelist = outbound_local_requests_whitelist_arrays + _, domain_allowlist = outbound_local_requests_allowlist_arrays - domain_whitelist.any? do |domain_whitelist_entry| - domain_whitelist_entry.match?(domain_string, port) + domain_allowlist.any? do |domain_allowlist_entry| + domain_allowlist_entry.match?(domain_string, port) end end private - attr_reader :ip_whitelist, :domain_whitelist - # We cannot use Gitlab::CurrentSettings as ApplicationSetting itself # calls this class. This ends up in a cycle where # Gitlab::CurrentSettings creates an ApplicationSetting which then # calls this method. # # See https://gitlab.com/gitlab-org/gitlab/issues/9833 - def outbound_local_requests_whitelist_arrays + def outbound_local_requests_allowlist_arrays return [[], []] unless ApplicationSetting.current - ApplicationSetting.current.outbound_local_requests_whitelist_arrays + ApplicationSetting.current.outbound_local_requests_allowlist_arrays end end end |