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
edd05fc4
Commit
edd05fc4
authored
Apr 10, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix directory traversal vulnerability around help pages.
parent
93133f4d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletion
+20
-1
CHANGELOG
CHANGELOG
+1
-0
app/controllers/help_controller.rb
app/controllers/help_controller.rb
+19
-1
No files found.
CHANGELOG
View file @
edd05fc4
...
...
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 7.10.0 (unreleased)
- Fix directory traversal vulnerability around uploads routes.
- Fix directory traversal vulnerability around help pages.
- Fix broken file browsing with a submodule that contains a relative link (Stan Hu)
- Fix bug where Wiki pages that included a '/' were no longer accessible (Stan Hu)
- Fix bug where error messages from Dropzone would not be displayed on the issues page (Stan Hu)
...
...
app/controllers/help_controller.rb
View file @
edd05fc4
...
...
@@ -3,7 +3,7 @@ class HelpController < ApplicationController
end
def
show
@filepath
=
params
[
:filepath
]
@filepath
=
clean_path_info
(
params
[
:filepath
])
@format
=
params
[
:format
]
respond_to
do
|
format
|
...
...
@@ -36,4 +36,22 @@ class HelpController < ApplicationController
def
ui
end
# Taken from ActionDispatch::FileHandler
PATH_SEPS
=
Regexp
.
union
(
*
[
::
File
::
SEPARATOR
,
::
File
::
ALT_SEPARATOR
].
compact
)
def
clean_path_info
(
path_info
)
parts
=
path_info
.
split
PATH_SEPS
clean
=
[]
parts
.
each
do
|
part
|
next
if
part
.
empty?
||
part
==
'.'
part
==
'..'
?
clean
.
pop
:
clean
<<
part
end
clean
.
unshift
'/'
if
parts
.
empty?
||
parts
.
first
.
empty?
::
File
.
join
(
*
clean
)
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