Commit bfb25039 authored by GitLab Release Tools Bot's avatar GitLab Release Tools Bot

Merge branch 'master' of dev.gitlab.org:gitlab/gitlab-ee

parents caae0ec3 4ca848bc
Please view this file on the master branch, on stable branches it's out of date. Please view this file on the master branch, on stable branches it's out of date.
## 13.3.1 (2020-08-25)
### Fixed (2 changes)
- Geo: Apply selective sync to container repo updates. !39663
- Geo: Apply selective sync to design repo updates. !39916
## 13.3.0 (2020-08-22) ## 13.3.0 (2020-08-22)
### Removed (7 changes) ### Removed (7 changes)
......
...@@ -2,6 +2,14 @@ ...@@ -2,6 +2,14 @@
documentation](doc/development/changelog.md) for instructions on adding your own documentation](doc/development/changelog.md) for instructions on adding your own
entry. entry.
## 13.3.1 (2020-08-25)
### Fixed (2 changes)
- Fix bug when promoting an Issue with attachments to an Epic. !39654
- Avoid creating diff position when line-code is nil. !40089
## 13.3.0 (2020-08-22) ## 13.3.0 (2020-08-22)
### Security (2 changes) ### Security (2 changes)
......
...@@ -17,4 +17,16 @@ module HooksExecution ...@@ -17,4 +17,16 @@ module HooksExecution
flash[:alert] = "Hook execution failed: #{message}" flash[:alert] = "Hook execution failed: #{message}"
end end
end end
def create_rate_limit(key, scope)
if rate_limiter.throttled?(key, scope: [scope, current_user])
rate_limiter.log_request(request, "#{key}_request_limit".to_sym, current_user)
render plain: _('This endpoint has been requested too many times. Try again later.'), status: :too_many_requests
end
end
def rate_limiter
::Gitlab::ApplicationRateLimiter
end
end end
...@@ -6,6 +6,7 @@ class Projects::HooksController < Projects::ApplicationController ...@@ -6,6 +6,7 @@ class Projects::HooksController < Projects::ApplicationController
# Authorize # Authorize
before_action :authorize_admin_project! before_action :authorize_admin_project!
before_action :hook_logs, only: :edit before_action :hook_logs, only: :edit
before_action -> { create_rate_limit(:project_testing_hook, @project) }, only: :test
respond_to :html respond_to :html
......
...@@ -92,7 +92,7 @@ class Projects::TagsController < Projects::ApplicationController ...@@ -92,7 +92,7 @@ class Projects::TagsController < Projects::ApplicationController
end end
format.js do format.js do
render status: :unprocessable_entity render status: :ok
end end
end end
end end
......
---
title: Avoid creating diff position when line-code is nil
merge_request: 40089
author:
type: fixed
---
title: Add rate limit on webhooks testing feature
merge_request:
author:
type: security
---
title: Upgrade jquery to v3.5
merge_request:
author:
type: security
...@@ -8,6 +8,7 @@ class Groups::HooksController < Groups::ApplicationController ...@@ -8,6 +8,7 @@ class Groups::HooksController < Groups::ApplicationController
before_action :authorize_admin_group! before_action :authorize_admin_group!
before_action :check_group_webhooks_available! before_action :check_group_webhooks_available!
before_action :set_hook, only: [:edit, :update, :test, :destroy] before_action :set_hook, only: [:edit, :update, :test, :destroy]
before_action -> { create_rate_limit(:group_testing_hook, @group) }, only: :test
respond_to :html respond_to :html
......
---
title: 'Geo: Apply selective sync to design repo updates'
merge_request: 39916
author:
type: fixed
...@@ -154,6 +154,24 @@ RSpec.describe Groups::HooksController do ...@@ -154,6 +154,24 @@ RSpec.describe Groups::HooksController do
expect(flash[:notice]).to eq('Hook executed successfully: HTTP 200') expect(flash[:notice]).to eq('Hook executed successfully: HTTP 200')
end end
end end
context 'when the endpoint receives requests above the limit' do
before do
allow(Gitlab::ApplicationRateLimiter).to receive(:rate_limits)
.and_return(group_testing_hook: { threshold: 1, interval: 1.minute })
end
it 'prevents making test requests' do
expect_next_instance_of(TestHooks::ProjectService) do |service|
expect(service).to receive(:execute).and_return(http_status: 200)
end
2.times { post :test, params: { group_id: group.to_param, id: hook } }
expect(response.body).to eq(_('This endpoint has been requested too many times. Try again later.'))
expect(response).to have_gitlab_http_status(:too_many_requests)
end
end
end end
end end
end end
......
...@@ -25,11 +25,13 @@ module Gitlab ...@@ -25,11 +25,13 @@ module Gitlab
project_repositories_archive: { threshold: 5, interval: 1.minute }, project_repositories_archive: { threshold: 5, interval: 1.minute },
project_generate_new_export: { threshold: -> { application_settings.project_export_limit }, interval: 1.minute }, project_generate_new_export: { threshold: -> { application_settings.project_export_limit }, interval: 1.minute },
project_import: { threshold: -> { application_settings.project_import_limit }, interval: 1.minute }, project_import: { threshold: -> { application_settings.project_import_limit }, interval: 1.minute },
project_testing_hook: { threshold: 5, interval: 1.minute },
play_pipeline_schedule: { threshold: 1, interval: 1.minute }, play_pipeline_schedule: { threshold: 1, interval: 1.minute },
show_raw_controller: { threshold: -> { application_settings.raw_blob_request_limit }, interval: 1.minute }, show_raw_controller: { threshold: -> { application_settings.raw_blob_request_limit }, interval: 1.minute },
group_export: { threshold: -> { application_settings.group_export_limit }, interval: 1.minute }, group_export: { threshold: -> { application_settings.group_export_limit }, interval: 1.minute },
group_download_export: { threshold: -> { application_settings.group_download_export_limit }, interval: 1.minute }, group_download_export: { threshold: -> { application_settings.group_download_export_limit }, interval: 1.minute },
group_import: { threshold: -> { application_settings.group_import_limit }, interval: 1.minute } group_import: { threshold: -> { application_settings.group_import_limit }, interval: 1.minute },
group_testing_hook: { threshold: 5, interval: 1.minute }
}.freeze }.freeze
end end
......
...@@ -47,4 +47,26 @@ RSpec.describe Projects::HooksController do ...@@ -47,4 +47,26 @@ RSpec.describe Projects::HooksController do
expect(ProjectHook.first).to have_attributes(hook_params) expect(ProjectHook.first).to have_attributes(hook_params)
end end
end end
describe '#test' do
let(:hook) { create(:project_hook, project: project) }
context 'when the endpoint receives requests above the limit' do
before do
allow(Gitlab::ApplicationRateLimiter).to receive(:rate_limits)
.and_return(project_testing_hook: { threshold: 1, interval: 1.minute })
end
it 'prevents making test requests' do
expect_next_instance_of(TestHooks::ProjectService) do |service|
expect(service).to receive(:execute).and_return(http_status: 200)
end
2.times { post :test, params: { namespace_id: project.namespace, project_id: project, id: hook } }
expect(response.body).to eq(_('This endpoint has been requested too many times. Try again later.'))
expect(response).to have_gitlab_http_status(:too_many_requests)
end
end
end
end end
...@@ -7078,10 +7078,10 @@ jquery.waitforimages@^2.2.0: ...@@ -7078,10 +7078,10 @@ jquery.waitforimages@^2.2.0:
resolved "https://registry.yarnpkg.com/jquery.waitforimages/-/jquery.waitforimages-2.2.0.tgz#63f23131055a1b060dc913e6d874bcc9b9e6b16b" resolved "https://registry.yarnpkg.com/jquery.waitforimages/-/jquery.waitforimages-2.2.0.tgz#63f23131055a1b060dc913e6d874bcc9b9e6b16b"
integrity sha1-Y/IxMQVaGwYNyRPm2HS8ybnmsWs= integrity sha1-Y/IxMQVaGwYNyRPm2HS8ybnmsWs=
"jquery@>= 1.9.1", jquery@>=1.8.0, jquery@^3.4.1: "jquery@>= 1.9.1", jquery@>=1.8.0, jquery@^3.5.0:
version "3.4.1" version "3.5.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.4.1.tgz#714f1f8d9dde4bdfa55764ba37ef214630d80ef2" resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.5.1.tgz#d7b4d08e1bfdb86ad2f1a3d039ea17304717abb5"
integrity sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw== integrity sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg==
js-base64@^2.1.8: js-base64@^2.1.8:
version "2.5.1" version "2.5.1"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment