Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-04-10 19:07:31 +0300
committerDouwe Maan <douwe@gitlab.com>2015-04-10 19:18:37 +0300
commit93133f4da9d950f47ca0ba2e437f9c004567e6f7 (patch)
treef33fc872f5d4cb166fca0e9e8e0ab063ace696b1 /config
parent24d139ba971cf61a4b7a01031c4c57bcba29b172 (diff)
Fix directory traversal vulnerability around uploads routes.
Diffstat (limited to 'config')
-rw-r--r--config/routes.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/config/routes.rb b/config/routes.rb
index c1b85b025b5..29207ed4d9b 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
@@ -485,7 +485,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