Class: Gitlab::Octokit::UrlValidation

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/octokit/url_validation.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ UrlValidation

Returns a new instance of UrlValidation.



6
7
8
# File 'lib/gitlab/octokit/url_validation.rb', line 6

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/gitlab/octokit/url_validation.rb', line 10

def call(env)
  Gitlab::HTTP_V2::UrlBlocker.validate!(env[:url],
    schemes: %w[http https],
    allow_localhost: allow_local_requests?,
    allow_local_network: allow_local_requests?,
    dns_rebind_protection: dns_rebind_protection?,
    deny_all_requests_except_allowed: Gitlab::CurrentSettings.deny_all_requests_except_allowed?,
    outbound_local_requests_allowlist: Gitlab::CurrentSettings.outbound_local_requests_whitelist # rubocop:disable Naming/InclusiveLanguage -- existing setting
  )

  @app.call(env)
end