From 9bd9d414afe3cae800ba0b93a5ffa91891809a11 Mon Sep 17 00:00:00 2001 From: Markus Koller Date: Wed, 23 Jun 2021 14:55:57 +0200 Subject: [PATCH] Remove web_hooks_rate_limit feature flag This still doesn't take effect until a rate limiting threshold is defined in `plan_limits`, which has been done now for Free users on gitlab.com. Changelog: changed --- app/services/web_hook_service.rb | 1 - .../development/web_hooks_rate_limit.yml | 8 ------- doc/administration/instance_limits.md | 24 +------------------ ee/spec/services/web_hook_service_spec.rb | 14 ----------- spec/services/web_hook_service_spec.rb | 13 ---------- 5 files changed, 1 insertion(+), 59 deletions(-) delete mode 100644 config/feature_flags/development/web_hooks_rate_limit.yml diff --git a/app/services/web_hook_service.rb b/app/services/web_hook_service.rb index 77d2139b3d1de5..5ed551ed90516a 100644 --- a/app/services/web_hook_service.rb +++ b/app/services/web_hook_service.rb @@ -176,7 +176,6 @@ def safe_response_body(response) end def rate_limited? - return false unless Feature.enabled?(:web_hooks_rate_limit, default_enabled: :yaml) return false if rate_limit.nil? Gitlab::ApplicationRateLimiter.throttled?( diff --git a/config/feature_flags/development/web_hooks_rate_limit.yml b/config/feature_flags/development/web_hooks_rate_limit.yml deleted file mode 100644 index 193d51bb250513..00000000000000 --- a/config/feature_flags/development/web_hooks_rate_limit.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: web_hooks_rate_limit -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/61151 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/330133 -milestone: '13.12' -type: development -group: group::ecosystem -default_enabled: false diff --git a/doc/administration/instance_limits.md b/doc/administration/instance_limits.md index bb49ebd873d380..c86733c43c6808 100644 --- a/doc/administration/instance_limits.md +++ b/doc/administration/instance_limits.md @@ -115,10 +115,7 @@ Limit the maximum daily member invitations allowed per group hierarchy. ### Webhook rate limit > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/61151) in GitLab 13.12. -> - [Deployed behind a feature flag](../user/feature_flags.md), disabled by default. -> - Disabled on GitLab.com. -> - Not recommended for production use. -> - To use in GitLab self-managed instances, ask a GitLab administrator to [enable it](#enable-or-disable-rate-limiting-for-webhooks). **(FREE SELF)** +> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/330133) in GitLab 14.1. Limit the number of times any given webhook can be called per minute. This only applies to project and group webhooks. @@ -136,25 +133,6 @@ Set the limit to `0` to disable it. - **Default rate limit**: Disabled. -#### Enable or disable rate limiting for webhooks **(FREE SELF)** - -Rate limiting for webhooks is under development and not ready for production use. It is -deployed behind a feature flag that is **disabled by default**. -[GitLab administrators with access to the GitLab Rails console](../administration/feature_flags.md) -can enable it. - -To enable it: - -```ruby -Feature.enable(:web_hooks_rate_limit) -``` - -To disable it: - -```ruby -Feature.disable(:web_hooks_rate_limit) -``` - ## Gitaly concurrency limit Clone traffic can put a large strain on your Gitaly service. To prevent such workloads from overwhelming your Gitaly server, you can set concurrency limits in Gitaly's configuration file. diff --git a/ee/spec/services/web_hook_service_spec.rb b/ee/spec/services/web_hook_service_spec.rb index 51a3d71b7c3afe..c2b4ef3985c2cc 100644 --- a/ee/spec/services/web_hook_service_spec.rb +++ b/ee/spec/services/web_hook_service_spec.rb @@ -19,20 +19,6 @@ service_instance.async_execute end - - context 'when the rate-limiting feature flag is disabled' do - before do - stub_feature_flags(web_hooks_rate_limit: false) - end - - it 'does not include the subscription plan in the worker context' do - expect(WebHookWorker).to receive(:perform_async) do - expect(Gitlab::ApplicationContext.current).not_to include('meta.subscription_plan') - end - - service_instance.async_execute - end - end end end end diff --git a/spec/services/web_hook_service_spec.rb b/spec/services/web_hook_service_spec.rb index 5f53d6f34d81fc..f9fa46a4fc82ca 100644 --- a/spec/services/web_hook_service_spec.rb +++ b/spec/services/web_hook_service_spec.rb @@ -418,19 +418,6 @@ def expect_to_rate_limit(hook, threshold:, throttled: false) described_class.new(other_hook, data, :push_hooks).async_execute end end - - context 'when the feature flag is disabled' do - before do - stub_feature_flags(web_hooks_rate_limit: false) - end - - it 'queues a worker without tracking the call' do - expect(Gitlab::ApplicationRateLimiter).not_to receive(:throttled?) - expect_to_perform_worker(project_hook) - - service_instance.async_execute - end - end end context 'when hook has custom context attributes' do -- GitLab