Skip to content
Snippets Groups Projects
Commit 3863794e authored by GitLab Release Tools Bot's avatar GitLab Release Tools Bot
Browse files

Merge branch 'security-psk-fix-external-wiki-integration-dos-17-1' into '17-1-stable-ee'

Fix external wiki integration DoS by changing request to HEAD

See merge request https://gitlab.com/gitlab-org/security/gitlab/-/merge_requests/4383



Merged-by: default avatarGitLab Release Tools Bot <delivery-team+release-tools@gitlab.com>
Approved-by: default avatarTerri Chu <tchu@gitlab.com>
Co-authored-by: default avatarPiotr Skorupa <pskorupa@gitlab.com>
parents c4e9c071 8ae880e3
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -41,8 +41,9 @@ def sections
end
 
def execute(_data)
response = Gitlab::HTTP.get(properties['external_wiki_url'], verify: true)
response.body if response.code == 200
response = Gitlab::HTTP.head(properties['external_wiki_url'], verify: true)
true if response.code == 200
rescue StandardError
nil
end
Loading
Loading
Loading
Loading
@@ -34,7 +34,7 @@
 
context 'the URL is not reachable' do
before do
WebMock.stub_request(:get, url).to_return(status: 404, body: 'not a page')
WebMock.stub_request(:head, url).to_return(status: 404)
end
 
it 'is not successful' do
Loading
Loading
@@ -44,7 +44,7 @@
 
context 'the URL is reachable' do
before do
WebMock.stub_request(:get, url).to_return(status: 200, body: 'foo')
WebMock.stub_request(:head, url).to_return(status: 200)
end
 
it 'is successful' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment