BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
c4b71fc4
Commit
c4b71fc4
authored
Apr 05, 2017
by
DJ Mountney
Committed by
DJ Mountney
Apr 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'path-disclosure-proj-import-export' into 'security'
Fix for path disclosure in project import/export See merge request !2080
parent
aa21d8cc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
1 deletion
+17
-1
projects_helper.rb
app/helpers/projects_helper.rb
+4
-1
file-import-export-path-disclosure.yml
changelogs/unreleased/file-import-export-path-disclosure.yml
+5
-0
projects_helper_spec.rb
spec/helpers/projects_helper_spec.rb
+8
-0
No files found.
app/helpers/projects_helper.rb
View file @
c4b71fc4
...
@@ -391,7 +391,10 @@ module ProjectsHelper
...
@@ -391,7 +391,10 @@ module ProjectsHelper
def
sanitize_repo_path
(
project
,
message
)
def
sanitize_repo_path
(
project
,
message
)
return
''
unless
message
.
present?
return
''
unless
message
.
present?
message
.
strip
.
gsub
(
project
.
repository_storage_path
.
chomp
(
'/'
),
"[REPOS PATH]"
)
exports_path
=
File
.
join
(
Settings
.
shared
[
'path'
],
'tmp/project_exports'
)
filtered_message
=
message
.
strip
.
gsub
(
exports_path
,
"[REPO EXPORT PATH]"
)
filtered_message
.
gsub
(
project
.
repository_storage_path
.
chomp
(
'/'
),
"[REPOS PATH]"
)
end
end
def
project_feature_options
def
project_feature_options
...
...
changelogs/unreleased/file-import-export-path-disclosure.yml
0 → 100644
View file @
c4b71fc4
---
title
:
Fix path disclosure in project import/export
merge_request
:
author
:
spec/helpers/projects_helper_spec.rb
View file @
c4b71fc4
...
@@ -127,6 +127,7 @@ describe ProjectsHelper do
...
@@ -127,6 +127,7 @@ describe ProjectsHelper do
before
do
before
do
allow
(
project
).
to
receive
(
:repository_storage_path
).
and_return
(
'/base/repo/path'
)
allow
(
project
).
to
receive
(
:repository_storage_path
).
and_return
(
'/base/repo/path'
)
allow
(
Settings
.
shared
).
to
receive
(
:[]
).
with
(
'path'
).
and_return
(
'/base/repo/export/path'
)
end
end
it
'removes the repo path'
do
it
'removes the repo path'
do
...
@@ -135,6 +136,13 @@ describe ProjectsHelper do
...
@@ -135,6 +136,13 @@ describe ProjectsHelper do
expect
(
sanitize_repo_path
(
project
,
import_error
)).
to
eq
(
'Could not clone [REPOS PATH]/namespace/test.git'
)
expect
(
sanitize_repo_path
(
project
,
import_error
)).
to
eq
(
'Could not clone [REPOS PATH]/namespace/test.git'
)
end
end
it
'removes the temporary repo path used for uploads/exports'
do
repo
=
'/base/repo/export/path/tmp/project_exports/uploads/test.tar.gz'
import_error
=
"Unable to decompress
#{
repo
}
\n
"
expect
(
sanitize_repo_path
(
project
,
import_error
)).
to
eq
(
'Unable to decompress [REPO EXPORT PATH]/uploads/test.tar.gz'
)
end
end
end
describe
'#last_push_event'
do
describe
'#last_push_event'
do
...
...
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