diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-04-10 18:07:31 +0200 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-04-10 18:18:37 +0200 |
commit | 93133f4da9d950f47ca0ba2e437f9c004567e6f7 (patch) | |
tree | f33fc872f5d4cb166fca0e9e8e0ab063ace696b1 /config | |
parent | 24d139ba971cf61a4b7a01031c4c57bcba29b172 (diff) | |
download | gitlab-ce-93133f4da9d950f47ca0ba2e437f9c004567e6f7.tar.gz |
Fix directory traversal vulnerability around uploads routes.
Diffstat (limited to 'config')
-rw-r--r-- | config/routes.rb | 8 |
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 |