Commit ebdb3c04 authored by mc_rocha's avatar mc_rocha

Handle invalid URL for DAST Site Profile

This Merge Request fix the validation for dast site profile url

Changelog: changed
MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/80170
parent 5407670f
...@@ -12,7 +12,7 @@ module AppSec ...@@ -12,7 +12,7 @@ module AppSec
return success_response(existing_validation.dast_site_token, existing_validation.state) if existing_validation return success_response(existing_validation.dast_site_token, existing_validation.state) if existing_validation
find_or_create_dast_site_token find_or_create_dast_site_token
rescue URI::InvalidURIError rescue Addressable::URI::InvalidURIError
error_response('Invalid target_url') error_response('Invalid target_url')
end end
......
...@@ -59,7 +59,7 @@ RSpec.describe AppSec::Dast::SiteTokens::FindOrCreateService do ...@@ -59,7 +59,7 @@ RSpec.describe AppSec::Dast::SiteTokens::FindOrCreateService do
let_it_be(:target_url) { 'http://bogus:broken' } let_it_be(:target_url) { 'http://bogus:broken' }
it 'communicates failure' do it 'communicates failure' do
expect(subject).to have_attributes(status: :error, message: ['Url is blocked: URI is invalid']) expect(subject).to have_attributes(status: :error, message: 'Invalid target_url')
end end
it 'does not create a dast_site_validation' do it 'does not create a dast_site_validation' do
......
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