gitlab-org--gitlab-foss/app/models/project_services/external_wiki_service.rb
Douwe Maan 95ced3bb5f Merge branch 'fj-15329-services-callbacks-ssrf' into 'security-10-6'
Server Side Request Forgery in Services and Web Hooks

See merge request gitlab/gitlabhq!2337
2018-03-21 14:39:21 +00:00

34 lines
688 B
Ruby

class ExternalWikiService < Service
prop_accessor :external_wiki_url
validates :external_wiki_url, presence: true, url: true, if: :activated?
def title
'External Wiki'
end
def description
'Replaces the link to the internal wiki with a link to an external wiki.'
end
def self.to_param
'external_wiki'
end
def fields
[
{ type: 'text', name: 'external_wiki_url', placeholder: 'The URL of the external Wiki', required: true }
]
end
def execute(_data)
@response = Gitlab::HTTP.get(properties['external_wiki_url'], verify: true) rescue nil
if @response != 200
nil
end
end
def self.supported_events
%w()
end
end