Commit 9d5becbc authored by Ash McKenzie's avatar Ash McKenzie

Merge branch 'investigate-dast-http-request-issue' into 'master'

Cut redundant validate! call from DAST service

See merge request gitlab-org/gitlab!47005
parents 5f95dc83 71878c5d
......@@ -33,8 +33,7 @@ module DastSiteValidations
end
def make_http_request!
uri, _ = Gitlab::UrlBlocker.validate!(dast_site_validation.validation_url)
Gitlab::HTTP.get(uri)
Gitlab::HTTP.get(dast_site_validation.validation_url)
end
def token_found?(response)
......
......@@ -40,11 +40,12 @@ RSpec.describe DastSiteValidations::ValidateService do
end
it 'validates the url before making an http request' do
uri = double('uri')
uri = URI(dast_site_validation.validation_url)
opt = hash_including(allow_local_network: false, allow_localhost: false, dns_rebind_protection: true)
aggregate_failures do
expect(Gitlab::UrlBlocker).to receive(:validate!).and_return([uri, nil])
expect(Gitlab::HTTP).to receive(:get).with(uri).and_return(double('response', body: token))
expect(Gitlab::UrlBlocker).to receive(:validate!).with(uri, opt).and_call_original
expect(Gitlab::HTTP).to receive(:get).with(dast_site_validation.validation_url).and_call_original
end
subject
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment