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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
48ab4c01
Commit
48ab4c01
authored
Oct 25, 2019
by
Igor Drozdov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return 404 on LFS request if project doesn't exist
parent
1581fb4c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
1 deletion
+48
-1
app/controllers/concerns/lfs_request.rb
app/controllers/concerns/lfs_request.rb
+1
-0
changelogs/unreleased/security-id-fix-disclosure-of-private-repo-names.yml
...ased/security-id-fix-disclosure-of-private-repo-names.yml
+5
-0
spec/controllers/concerns/lfs_request_spec.rb
spec/controllers/concerns/lfs_request_spec.rb
+42
-1
No files found.
app/controllers/concerns/lfs_request.rb
View file @
48ab4c01
...
...
@@ -34,6 +34,7 @@ module LfsRequest
end
def
lfs_check_access!
return
render_lfs_not_found
unless
project
return
if
download_request?
&&
lfs_download_access?
return
if
upload_request?
&&
lfs_upload_access?
...
...
changelogs/unreleased/security-id-fix-disclosure-of-private-repo-names.yml
0 → 100644
View file @
48ab4c01
---
title
:
Return 404 on LFS request if project doesn't exist
merge_request
:
author
:
type
:
security
spec/controllers/concerns/lfs_request_spec.rb
View file @
48ab4c01
...
...
@@ -16,13 +16,17 @@ describe LfsRequest do
end
def
project
@project
||=
Project
.
find
(
params
[
:id
])
@project
||=
Project
.
find
_by
(
id:
params
[
:id
])
end
def
download_request?
true
end
def
upload_request?
false
end
def
ci?
false
end
...
...
@@ -49,4 +53,41 @@ describe LfsRequest do
expect
(
assigns
(
:storage_project
)).
to
eq
(
project
)
end
end
context
'user is authenticated without access to lfs'
do
before
do
allow
(
controller
).
to
receive
(
:authenticate_user
)
allow
(
controller
).
to
receive
(
:authentication_result
)
do
Gitlab
::
Auth
::
Result
.
new
end
end
context
'with access to the project'
do
it
'returns 403'
do
get
:show
,
params:
{
id:
project
.
id
}
expect
(
response
.
status
).
to
eq
(
403
)
end
end
context
'without access to the project'
do
context
'project does not exist'
do
it
'returns 404'
do
get
:show
,
params:
{
id:
'does not exist'
}
expect
(
response
.
status
).
to
eq
(
404
)
end
end
context
'project is private'
do
let
(
:project
)
{
create
(
:project
,
:private
)
}
it
'returns 404'
do
get
:show
,
params:
{
id:
project
.
id
}
expect
(
response
.
status
).
to
eq
(
404
)
end
end
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