diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-03 21:06:23 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-03 21:06:23 +0000 |
commit | 4529c19950e412f0461910585414f8633d3b1b18 (patch) | |
tree | 00b75c579ef52b41fea09c516cd5286dee5df703 /config | |
parent | ab7cf450ba19cf80b9534f25dc707b33845e3014 (diff) | |
download | gitlab-ce-4529c19950e412f0461910585414f8633d3b1b18.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'config')
-rw-r--r-- | config/initializers/rack_attack_git_basic_auth.rb | 14 | ||||
-rw-r--r-- | config/routes/project.rb | 30 |
2 files changed, 15 insertions, 29 deletions
diff --git a/config/initializers/rack_attack_git_basic_auth.rb b/config/initializers/rack_attack_git_basic_auth.rb deleted file mode 100644 index 71e5e2969ce..00000000000 --- a/config/initializers/rack_attack_git_basic_auth.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Tell the Rack::Attack Rack middleware to maintain an IP blacklist. -# We update the blacklist in Gitlab::Auth::IpRateLimiter. -Rack::Attack.blocklist('Git HTTP Basic Auth') do |req| - rate_limiter = Gitlab::Auth::IpRateLimiter.new(req.ip) - - next false if !rate_limiter.enabled? || rate_limiter.trusted_ip? - - Rack::Attack::Allow2Ban.filter(req.ip, Gitlab.config.rack_attack.git_basic_auth) do - # This block only gets run if the IP was not already banned. - # Return false, meaning that we do not see anything wrong with the - # request at this time - false - end -end diff --git a/config/routes/project.rb b/config/routes/project.rb index 848846b5f5b..8a5e20c8eff 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -58,7 +58,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do get :trace, defaults: { format: 'json' } get :raw get :terminal - get '/terminal.ws/authorize', to: 'jobs#terminal_websocket_authorize', constraints: { format: nil } + get '/terminal.ws/authorize', to: 'jobs#terminal_websocket_authorize', format: false end resource :artifacts, only: [] do @@ -228,7 +228,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do get :metrics get :additional_metrics get :metrics_dashboard - get '/terminal.ws/authorize', to: 'environments#terminal_websocket_authorize', constraints: { format: nil } + get '/terminal.ws/authorize', to: 'environments#terminal_websocket_authorize', format: false get '/prometheus/api/v1/*proxy_path', to: 'environments/prometheus_api#proxy', as: :prometheus_api end @@ -328,13 +328,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do get :test_reports get :exposed_artifacts - scope constraints: { format: nil }, action: :show do - get :commits, defaults: { tab: 'commits' } - get :pipelines, defaults: { tab: 'pipelines' } - get :diffs, defaults: { tab: 'diffs' } - end - - scope constraints: { format: 'json' }, as: :json do + scope constraints: ->(req) { req.format == :json }, as: :json do get :commits get :pipelines get :diffs, to: 'merge_requests/diffs#show' @@ -344,6 +338,12 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do get :cached_widget, to: 'merge_requests/content#cached_widget' end + scope action: :show do + get :commits, defaults: { tab: 'commits' } + get :pipelines, defaults: { tab: 'pipelines' } + get :diffs, defaults: { tab: 'diffs' } + end + get :diff_for_path, controller: 'merge_requests/diffs' scope controller: 'merge_requests/conflicts' do @@ -372,16 +372,16 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do scope path: 'new', as: :new_merge_request do get '', action: :new - scope constraints: { format: nil }, action: :new do - get :diffs, defaults: { tab: 'diffs' } - get :pipelines, defaults: { tab: 'pipelines' } - end - - scope constraints: { format: 'json' }, as: :json do + scope constraints: ->(req) { req.format == :json }, as: :json do get :diffs get :pipelines end + scope action: :new do + get :diffs, defaults: { tab: 'diffs' } + get :pipelines, defaults: { tab: 'pipelines' } + end + get :diff_for_path get :branch_from get :branch_to |