summaryrefslogtreecommitdiff
path: root/config/routes.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-04-14 13:07:27 +0000
committerDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-04-14 13:07:27 +0000
commitbf7932bd06e45f82c7aa80373aa3aa1bf52d4d88 (patch)
tree2050f84049c32e1ae97302dd74888ab7d7b72824 /config/routes.rb
parent582bff2ce437cb5c79d08827d68a566ca6689f4b (diff)
parent5e2f25c32ee36ed5a4ad137c299b60d91b7ebdeb (diff)
downloadgitlab-ce-bf7932bd06e45f82c7aa80373aa3aa1bf52d4d88.tar.gz
Merge branch 'dir-traversal' into 'master'
Fix directory traversal vulnerabilities Fixes gitlab/gitlab-ee#272. As @joern mentions: > This is not exploitable via the front-end nginx. But nevertheless this issue should be addressed. See merge request !1760
Diffstat (limited to 'config/routes.rb')
-rw-r--r--config/routes.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/config/routes.rb b/config/routes.rb
index de21f418329..63eb7d0fe85 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -91,18 +91,18 @@ Gitlab::Application.routes.draw do
# Note attachments and User/Group/Project avatars
get ":model/:mounted_as/:id/:filename",
to: "uploads#show",
- constraints: { model: /note|user|group|project/, mounted_as: /avatar|attachment/, filename: /.+/ }
+ constraints: { model: /note|user|group|project/, mounted_as: /avatar|attachment/, filename: /[^\/]+/ }
# Project markdown uploads
get ":namespace_id/:project_id/:secret/:filename",
to: "projects/uploads#show",
- constraints: { namespace_id: /[a-zA-Z.0-9_\-]+/, project_id: /[a-zA-Z.0-9_\-]+/, filename: /.+/ }
+ constraints: { namespace_id: /[a-zA-Z.0-9_\-]+/, project_id: /[a-zA-Z.0-9_\-]+/, filename: /[^\/]+/ }
end
# Redirect old note attachments path to new uploads path.
get "files/note/:id/:filename",
to: redirect("uploads/note/attachment/%{id}/%{filename}"),
- constraints: { filename: /.+/ }
+ constraints: { filename: /[^\/]+/ }
#
# Explore area
@@ -487,7 +487,7 @@ Gitlab::Application.routes.draw do
resources :uploads, only: [:create] do
collection do
- get ":secret/:filename", action: :show, as: :show, constraints: { filename: /.+/ }
+ get ":secret/:filename", action: :show, as: :show, constraints: { filename: /[^\/]+/ }
end
end
end