Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
dd2c1977
Commit
dd2c1977
authored
Mar 19, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
c21bea5d
8fd407be
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
0 deletions
+25
-0
app/controllers/projects/git_http_controller.rb
app/controllers/projects/git_http_controller.rb
+5
-0
changelogs/unreleased/sh-reject-info-refs-head-requests.yml
changelogs/unreleased/sh-reject-info-refs-head-requests.yml
+5
-0
spec/controllers/projects/git_http_controller_spec.rb
spec/controllers/projects/git_http_controller_spec.rb
+15
-0
No files found.
app/controllers/projects/git_http_controller.rb
View file @
dd2c1977
...
...
@@ -4,6 +4,7 @@ class Projects::GitHttpController < Projects::GitHttpClientController
include
WorkhorseRequest
before_action
:access_check
prepend_before_action
:deny_head_requests
,
only:
[
:info_refs
]
rescue_from
Gitlab
::
GitAccess
::
UnauthorizedError
,
with: :render_403
rescue_from
Gitlab
::
GitAccess
::
NotFoundError
,
with: :render_404
...
...
@@ -32,6 +33,10 @@ class Projects::GitHttpController < Projects::GitHttpClientController
private
def
deny_head_requests
head
:forbidden
if
request
.
head?
end
def
download_request?
upload_pack?
end
...
...
changelogs/unreleased/sh-reject-info-refs-head-requests.yml
0 → 100644
View file @
dd2c1977
---
title
:
Reject HEAD requests to info/refs endpoint
merge_request
:
26334
author
:
type
:
fixed
spec/controllers/projects/git_http_controller_spec.rb
0 → 100644
View file @
dd2c1977
# frozen_string_literal: true
require
'spec_helper'
describe
Projects
::
GitHttpController
do
describe
'HEAD #info_refs'
do
it
'returns 403'
do
project
=
create
(
:project
,
:public
,
:repository
)
head
:info_refs
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
path
+
'.git'
}
expect
(
response
.
status
).
to
eq
(
403
)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment