summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md39
-rw-r--r--GITLAB_PAGES_VERSION2
-rw-r--r--GITLAB_WORKHORSE_VERSION2
-rw-r--r--app/assets/javascripts/jobs/components/stages_dropdown.vue5
-rw-r--r--app/assets/javascripts/pipelines/components/graph/graph_component_wrapper.vue3
-rw-r--r--app/assets/javascripts/pipelines/components/graph/linked_pipelines_column.vue9
-rw-r--r--app/assets/javascripts/pipelines/components/graph/utils.js8
-rw-r--r--app/controllers/oauth/authorizations_controller.rb11
-rw-r--r--app/controllers/projects/raw_controller.rb2
-rw-r--r--app/controllers/projects/repositories_controller.rb2
-rw-r--r--app/services/merge_requests/after_create_service.rb1
-rw-r--r--app/services/merge_requests/base_service.rb4
-rw-r--r--app/services/merge_requests/close_service.rb1
-rw-r--r--app/services/merge_requests/merge_service.rb8
-rw-r--r--app/services/merge_requests/post_merge_service.rb1
-rw-r--r--app/services/merge_requests/reopen_service.rb1
-rw-r--r--app/services/projects/unlink_fork_service.rb13
-rw-r--r--changelogs/unreleased/292827-track-action-metrics-for-a-merge-request.yml5
-rw-r--r--changelogs/unreleased/extend-ci-minutes-reset-window.yml5
-rw-r--r--changelogs/unreleased/security-workhorse-prometheus.yml5
-rw-r--r--changelogs/unreleased/sh-accelerate-s3-copy.yml5
-rw-r--r--config/feature_flags/development/persist_squash_commit_sha_for_squashes.yml8
-rw-r--r--config/feature_flags/development/s3_multithreaded_uploads.yml8
-rw-r--r--config/feature_flags/development/usage_data_i_code_review_user_close_mr.yml8
-rw-r--r--config/feature_flags/development/usage_data_i_code_review_user_create_mr.yml8
-rw-r--r--config/feature_flags/development/usage_data_i_code_review_user_merge_mr.yml8
-rw-r--r--config/feature_flags/development/usage_data_i_code_review_user_reopen_mr.yml8
-rw-r--r--config/initializers/carrierwave_patch.rb17
-rw-r--r--db/migrate/20201222151823_update_trusted_apps_to_confidential.rb23
-rw-r--r--db/schema_migrations/202012221518231
-rw-r--r--db/structure.sql4
-rw-r--r--doc/administration/compliance.md4
-rw-r--r--doc/user/project/integrations/img/webhooks_ssl.pngbin58529 -> 0 bytes
-rw-r--r--doc/user/project/integrations/webhooks.md31
-rw-r--r--doc/user/project/issues/csv_export.md2
-rw-r--r--lib/api/concerns/packages/nuget_endpoints.rb2
-rw-r--r--lib/gitlab/error_tracking.rb8
-rw-r--r--lib/gitlab/regex.rb13
-rw-r--r--lib/gitlab/usage_data_counters/known_events/common.yml21
-rw-r--r--lib/gitlab/usage_data_counters/merge_request_activity_unique_counter.rb20
-rw-r--r--qa/qa/page/project/job/show.rb2
-rw-r--r--qa/qa/page/project/pipeline/show.rb2
-rw-r--r--qa/qa/specs/features/browser_ui/6_release/pages/pages_pipeline_spec.rb45
-rw-r--r--spec/controllers/oauth/authorizations_controller_spec.rb14
-rw-r--r--spec/controllers/projects/raw_controller_spec.rb12
-rw-r--r--spec/controllers/projects/repositories_controller_spec.rb12
-rw-r--r--spec/initializers/carrierwave_patch_spec.rb89
-rw-r--r--spec/lib/gitlab/regex_spec.rb6
-rw-r--r--spec/lib/gitlab/sidekiq_middleware_spec.rb2
-rw-r--r--spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb32
-rw-r--r--spec/rubocop/cop/active_record_association_reload_spec.rb2
-rw-r--r--spec/rubocop/cop/api/base_spec.rb2
-rw-r--r--spec/rubocop/cop/avoid_becomes_spec.rb2
-rw-r--r--spec/rubocop/cop/avoid_break_from_strong_memoize_spec.rb2
-rw-r--r--spec/rubocop/cop/avoid_keyword_arguments_in_sidekiq_workers_spec.rb2
-rw-r--r--spec/rubocop/cop/avoid_return_from_blocks_spec.rb2
-rw-r--r--spec/rubocop/cop/avoid_route_redirect_leading_slash_spec.rb2
-rw-r--r--spec/rubocop/cop/ban_catch_throw_spec.rb2
-rw-r--r--spec/rubocop/cop/code_reuse/finder_spec.rb2
-rw-r--r--spec/rubocop/cop/code_reuse/presenter_spec.rb2
-rw-r--r--spec/rubocop/cop/code_reuse/serializer_spec.rb2
-rw-r--r--spec/rubocop/cop/code_reuse/service_class_spec.rb2
-rw-r--r--spec/rubocop/cop/code_reuse/worker_spec.rb2
-rw-r--r--spec/rubocop/cop/default_scope_spec.rb2
-rw-r--r--spec/rubocop/cop/destroy_all_spec.rb2
-rw-r--r--spec/rubocop/cop/filename_length_spec.rb2
-rw-r--r--spec/rubocop/cop/gitlab/avoid_uploaded_file_from_params_spec.rb2
-rw-r--r--spec/rubocop/cop/gitlab/bulk_insert_spec.rb2
-rw-r--r--spec/rubocop/cop/gitlab/change_timezone_spec.rb2
-rw-r--r--spec/rubocop/cop/gitlab/const_get_inherit_false_spec.rb2
-rw-r--r--spec/rubocop/cop/gitlab/duplicate_spec_location_spec.rb2
-rw-r--r--spec/rubocop/cop/gitlab/except_spec.rb2
-rw-r--r--spec/rubocop/cop/gitlab/finder_with_find_by_spec.rb2
-rw-r--r--spec/rubocop/cop/gitlab/httparty_spec.rb2
-rw-r--r--spec/rubocop/cop/gitlab/intersect_spec.rb2
-rw-r--r--spec/rubocop/cop/gitlab/json_spec.rb2
-rw-r--r--spec/rubocop/cop/gitlab/module_with_instance_variables_spec.rb2
-rw-r--r--spec/rubocop/cop/gitlab/policy_rule_boolean_spec.rb2
-rw-r--r--spec/rubocop/cop/gitlab/predicate_memoization_spec.rb2
-rw-r--r--spec/rubocop/cop/gitlab/rails_logger_spec.rb2
-rw-r--r--spec/rubocop/cop/gitlab/union_spec.rb2
-rw-r--r--spec/rubocop/cop/graphql/authorize_types_spec.rb2
-rw-r--r--spec/rubocop/cop/graphql/descriptions_spec.rb2
-rw-r--r--spec/rubocop/cop/graphql/gid_expected_type_spec.rb2
-rw-r--r--spec/rubocop/cop/graphql/id_type_spec.rb2
-rw-r--r--spec/rubocop/cop/graphql/json_type_spec.rb2
-rw-r--r--spec/rubocop/cop/graphql/resolver_type_spec.rb2
-rw-r--r--spec/rubocop/cop/group_public_or_visible_to_user_spec.rb2
-rw-r--r--spec/rubocop/cop/ignored_columns_spec.rb2
-rw-r--r--spec/rubocop/cop/include_sidekiq_worker_spec.rb2
-rw-r--r--spec/rubocop/cop/inject_enterprise_edition_module_spec.rb2
-rw-r--r--spec/rubocop/cop/lint/last_keyword_argument_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/add_column_with_default_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/add_columns_to_wide_tables_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/add_concurrent_foreign_key_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/add_concurrent_index_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/add_index_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/add_limit_to_text_columns_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/add_reference_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/add_timestamps_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/complex_indexes_require_name_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/create_table_with_foreign_keys_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/datetime_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/drop_table_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/hash_index_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/prevent_strings_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/refer_to_index_by_name_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/remove_column_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/remove_concurrent_index_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/remove_index_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/safer_boolean_column_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/timestamps_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/update_column_in_batches_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/with_lock_retries_disallowed_method_spec.rb2
-rw-r--r--spec/rubocop/cop/migration/with_lock_retries_with_change_spec.rb2
-rw-r--r--spec/rubocop/cop/performance/ar_count_each_spec.rb2
-rw-r--r--spec/rubocop/cop/performance/ar_exists_and_present_blank_spec.rb2
-rw-r--r--spec/rubocop/cop/performance/readlines_each_spec.rb2
-rw-r--r--spec/rubocop/cop/prefer_class_methods_over_module_spec.rb2
-rw-r--r--spec/rubocop/cop/project_path_helper_spec.rb2
-rw-r--r--spec/rubocop/cop/put_group_routes_under_scope_spec.rb2
-rw-r--r--spec/rubocop/cop/put_project_routes_under_scope_spec.rb2
-rw-r--r--spec/rubocop/cop/qa/ambiguous_page_object_name_spec.rb2
-rw-r--r--spec/rubocop/cop/qa/element_with_pattern_spec.rb2
-rw-r--r--spec/rubocop/cop/rspec/any_instance_of_spec.rb2
-rw-r--r--spec/rubocop/cop/rspec/be_success_matcher_spec.rb2
-rw-r--r--spec/rubocop/cop/rspec/env_assignment_spec.rb2
-rw-r--r--spec/rubocop/cop/rspec/factories_in_migration_specs_spec.rb2
-rw-r--r--spec/rubocop/cop/rspec/factory_bot/inline_association_spec.rb2
-rw-r--r--spec/rubocop/cop/rspec/htt_party_basic_auth_spec.rb2
-rw-r--r--spec/rubocop/cop/rspec/modify_sidekiq_middleware_spec.rb2
-rw-r--r--spec/rubocop/cop/rspec/timecop_freeze_spec.rb2
-rw-r--r--spec/rubocop/cop/rspec/timecop_travel_spec.rb2
-rw-r--r--spec/rubocop/cop/rspec/top_level_describe_path_spec.rb2
-rw-r--r--spec/rubocop/cop/ruby_interpolation_in_translation_spec.rb2
-rw-r--r--spec/rubocop/cop/safe_params_spec.rb2
-rw-r--r--spec/rubocop/cop/scalability/bulk_perform_with_context_spec.rb2
-rw-r--r--spec/rubocop/cop/scalability/cron_worker_context_spec.rb2
-rw-r--r--spec/rubocop/cop/scalability/file_uploads_spec.rb2
-rw-r--r--spec/rubocop/cop/scalability/idempotent_worker_spec.rb2
-rw-r--r--spec/rubocop/cop/sidekiq_options_queue_spec.rb2
-rw-r--r--spec/rubocop/cop/static_translation_definition_spec.rb2
-rw-r--r--spec/rubocop/cop/usage_data/distinct_count_by_large_foreign_key_spec.rb2
-rw-r--r--spec/rubocop/cop/usage_data/large_table_spec.rb2
-rw-r--r--spec/rubocop/qa_helpers_spec.rb2
-rw-r--r--spec/services/merge_requests/after_create_service_spec.rb8
-rw-r--r--spec/services/merge_requests/close_service_spec.rb8
-rw-r--r--spec/services/merge_requests/merge_service_spec.rb42
-rw-r--r--spec/services/merge_requests/post_merge_service_spec.rb8
-rw-r--r--spec/services/merge_requests/reopen_service_spec.rb8
-rw-r--r--spec/support/rspec.rb4
-rw-r--r--workhorse/CHANGELOG12
-rw-r--r--workhorse/VERSION2
-rw-r--r--workhorse/internal/rejectmethods/middleware.go38
-rw-r--r--workhorse/internal/rejectmethods/middleware_test.go43
-rw-r--r--workhorse/internal/upstream/upstream.go3
-rw-r--r--workhorse/main_test.go18
157 files changed, 759 insertions, 167 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fe4775033e1..645cc391339 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,19 @@
documentation](doc/development/changelog.md) for instructions on adding your own
entry.
+## 13.7.2 (2021-01-07)
+
+### Security (7 changes)
+
+- Forbid public cache for private repos.
+- Deny implicit flow for confidential apps.
+- Update NuGet regular expression to protect against ReDoS.
+- Fix regular expression backtracking issue in package name validation.
+- Fix stealing API token from GitLab Pages and DoS Prometheus through GitLab Pages.
+- Update trusted OAuth applications to set them as confidential.
+- Upgrade Workhorse to 8.58.2.
+
+
## 13.7.1 (2020-12-23)
### Fixed (1 change)
@@ -471,6 +484,19 @@ entry.
- Update GitLab Workhorse to v8.57.0.
+## 13.6.4 (2021-01-07)
+
+### Security (7 changes)
+
+- Forbid public cache for private repos.
+- Deny implicit flow for confidential apps.
+- Update NuGet regular expression to protect against ReDoS.
+- Fix regular expression backtracking issue in package name validation.
+- Upgrade GitLab Pages to 1.30.2.
+- Update trusted OAuth applications to set them as confidential.
+- Upgrade Workhorse to 8.54.2.
+
+
## 13.6.3 (2020-12-10)
### Fixed (5 changes)
@@ -1029,6 +1055,19 @@ entry.
- Change wording on the project remove fork page. !47878
+## 13.5.6 (2021-01-07)
+
+### Security (7 changes)
+
+- Forbid public cache for private repos.
+- Deny implicit flow for confidential apps.
+- Update NuGet regular expression to protect against ReDoS.
+- Fix regular expression backtracking issue in package name validation.
+- Upgrade GitLab Pages to 1.28.2.
+- Update trusted OAuth applications to set them as confidential.
+- Upgrade Workhorse to 8.51.2.
+
+
## 13.5.5 (2020-12-07)
### Security (10 changes)
diff --git a/GITLAB_PAGES_VERSION b/GITLAB_PAGES_VERSION
index 359c41089a4..2b17ffd5042 100644
--- a/GITLAB_PAGES_VERSION
+++ b/GITLAB_PAGES_VERSION
@@ -1 +1 @@
-1.32.0
+1.34.0
diff --git a/GITLAB_WORKHORSE_VERSION b/GITLAB_WORKHORSE_VERSION
index b315ff1896d..8aa8b5f68bd 100644
--- a/GITLAB_WORKHORSE_VERSION
+++ b/GITLAB_WORKHORSE_VERSION
@@ -1 +1 @@
-8.58.0
+8.58.2
diff --git a/app/assets/javascripts/jobs/components/stages_dropdown.vue b/app/assets/javascripts/jobs/components/stages_dropdown.vue
index aeae9f26ed3..7d4fe0a0680 100644
--- a/app/assets/javascripts/jobs/components/stages_dropdown.vue
+++ b/app/assets/javascripts/jobs/components/stages_dropdown.vue
@@ -48,7 +48,10 @@ export default {
<ci-icon :status="pipeline.details.status" class="vertical-align-middle" />
<span class="font-weight-bold">{{ s__('Job|Pipeline') }}</span>
- <gl-link :href="pipeline.path" class="js-pipeline-path link-commit qa-pipeline-path"
+ <gl-link
+ :href="pipeline.path"
+ class="js-pipeline-path link-commit"
+ data-qa-selector="pipeline_path"
>#{{ pipeline.id }}</gl-link
>
<template v-if="hasRef">
diff --git a/app/assets/javascripts/pipelines/components/graph/graph_component_wrapper.vue b/app/assets/javascripts/pipelines/components/graph/graph_component_wrapper.vue
index d98e3aad054..534f0e9691f 100644
--- a/app/assets/javascripts/pipelines/components/graph/graph_component_wrapper.vue
+++ b/app/assets/javascripts/pipelines/components/graph/graph_component_wrapper.vue
@@ -4,7 +4,7 @@ import { __ } from '~/locale';
import { DEFAULT, LOAD_FAILURE } from '../../constants';
import getPipelineDetails from '../../graphql/queries/get_pipeline_details.query.graphql';
import PipelineGraph from './graph_component.vue';
-import { unwrapPipelineData, toggleQueryPollingByVisibility } from './utils';
+import { unwrapPipelineData, toggleQueryPollingByVisibility, reportToSentry } from './utils';
export default {
name: 'PipelineGraphWrapper',
@@ -86,6 +86,7 @@ export default {
reportFailure(type) {
this.showAlert = true;
this.failureType = type;
+ reportToSentry(this.$options.name, this.failureType);
},
},
};
diff --git a/app/assets/javascripts/pipelines/components/graph/linked_pipelines_column.vue b/app/assets/javascripts/pipelines/components/graph/linked_pipelines_column.vue
index 7d333087874..9fca4a3ff55 100644
--- a/app/assets/javascripts/pipelines/components/graph/linked_pipelines_column.vue
+++ b/app/assets/javascripts/pipelines/components/graph/linked_pipelines_column.vue
@@ -3,7 +3,7 @@ import getPipelineDetails from '../../graphql/queries/get_pipeline_details.query
import LinkedPipeline from './linked_pipeline.vue';
import { LOAD_FAILURE } from '../../constants';
import { UPSTREAM } from './constants';
-import { unwrapPipelineData, toggleQueryPollingByVisibility } from './utils';
+import { unwrapPipelineData, toggleQueryPollingByVisibility, reportToSentry } from './utils';
export default {
components: {
@@ -80,8 +80,13 @@ export default {
result() {
this.loadingPipelineId = null;
},
- error() {
+ error(err, _vm, _key, type) {
this.$emit('error', LOAD_FAILURE);
+
+ reportToSentry(
+ 'linked_pipelines_column',
+ `error type: ${LOAD_FAILURE}, error: ${err}, apollo error type: ${type}`,
+ );
},
});
diff --git a/app/assets/javascripts/pipelines/components/graph/utils.js b/app/assets/javascripts/pipelines/components/graph/utils.js
index 74cdbfb0a92..1a935599bfa 100644
--- a/app/assets/javascripts/pipelines/components/graph/utils.js
+++ b/app/assets/javascripts/pipelines/components/graph/utils.js
@@ -1,5 +1,6 @@
import Visibility from 'visibilityjs';
import { getIdFromGraphQLId } from '~/graphql_shared/utils';
+import * as Sentry from '~/sentry/wrapper';
import { unwrapStagesWithNeeds } from '../unwrapping_utils';
const addMulti = (mainPipelineProjectPath, linkedPipeline) => {
@@ -55,3 +56,10 @@ const toggleQueryPollingByVisibility = (queryRef, interval = 10000) => {
};
export { unwrapPipelineData, toggleQueryPollingByVisibility };
+
+export const reportToSentry = (component, failureType) => {
+ Sentry.withScope((scope) => {
+ scope.setTag('component', component);
+ Sentry.captureException(failureType);
+ });
+};
diff --git a/app/controllers/oauth/authorizations_controller.rb b/app/controllers/oauth/authorizations_controller.rb
index 6e8686ee90b..ade698baa7f 100644
--- a/app/controllers/oauth/authorizations_controller.rb
+++ b/app/controllers/oauth/authorizations_controller.rb
@@ -24,6 +24,17 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
end
end
+ def create
+ # Confidential apps require the client_secret to be sent with the request.
+ # Doorkeeper allows implicit grant flow requests (response_type=token) to
+ # work without client_secret regardless of the confidential setting.
+ if pre_auth.authorizable? && pre_auth.response_type == 'token' && pre_auth.client.application.confidential
+ render "doorkeeper/authorizations/error"
+ else
+ super
+ end
+ end
+
private
def verify_confirmed_email!
diff --git a/app/controllers/projects/raw_controller.rb b/app/controllers/projects/raw_controller.rb
index 8be7af3e2c5..3fff93abe5c 100644
--- a/app/controllers/projects/raw_controller.rb
+++ b/app/controllers/projects/raw_controller.rb
@@ -21,7 +21,7 @@ class Projects::RawController < Projects::ApplicationController
def show
@blob = @repository.blob_at(@ref, @path)
- send_blob(@repository, @blob, inline: (params[:inline] != 'false'), allow_caching: @project.public?)
+ send_blob(@repository, @blob, inline: (params[:inline] != 'false'), allow_caching: Guest.can?(:download_code, @project))
end
private
diff --git a/app/controllers/projects/repositories_controller.rb b/app/controllers/projects/repositories_controller.rb
index fb6a09cff65..da018b24836 100644
--- a/app/controllers/projects/repositories_controller.rb
+++ b/app/controllers/projects/repositories_controller.rb
@@ -53,7 +53,7 @@ class Projects::RepositoriesController < Projects::ApplicationController
end
def set_cache_headers
- expires_in cache_max_age(archive_metadata['CommitId']), public: project.public?
+ expires_in cache_max_age(archive_metadata['CommitId']), public: Guest.can?(:download_code, project)
fresh_when(etag: archive_metadata['ArchivePath'])
end
diff --git a/app/services/merge_requests/after_create_service.rb b/app/services/merge_requests/after_create_service.rb
index fbb9d5fa9dc..5313afd62b4 100644
--- a/app/services/merge_requests/after_create_service.rb
+++ b/app/services/merge_requests/after_create_service.rb
@@ -4,6 +4,7 @@ module MergeRequests
class AfterCreateService < MergeRequests::BaseService
def execute(merge_request)
event_service.open_mr(merge_request, current_user)
+ merge_request_activity_counter.track_create_mr_action(user: current_user)
notification_service.new_merge_request(merge_request, current_user)
create_pipeline_for(merge_request, current_user)
diff --git a/app/services/merge_requests/base_service.rb b/app/services/merge_requests/base_service.rb
index 265b211066e..0613c061f2e 100644
--- a/app/services/merge_requests/base_service.rb
+++ b/app/services/merge_requests/base_service.rb
@@ -52,6 +52,10 @@ module MergeRequests
"#<#{self.class} #{merge_request.to_reference(full: true)}>"
end
+ def merge_request_activity_counter
+ Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter
+ end
+
private
def enqueue_jira_connect_messages_for(merge_request)
diff --git a/app/services/merge_requests/close_service.rb b/app/services/merge_requests/close_service.rb
index b0a7face594..ab0e7e4ad06 100644
--- a/app/services/merge_requests/close_service.rb
+++ b/app/services/merge_requests/close_service.rb
@@ -13,6 +13,7 @@ module MergeRequests
if merge_request.close
create_event(merge_request)
+ merge_request_activity_counter.track_close_mr_action(user: current_user)
create_note(merge_request)
notification_service.async.close_mr(merge_request, current_user)
todo_service.close_merge_request(merge_request, current_user)
diff --git a/app/services/merge_requests/merge_service.rb b/app/services/merge_requests/merge_service.rb
index ba22b458777..407f2ad70f8 100644
--- a/app/services/merge_requests/merge_service.rb
+++ b/app/services/merge_requests/merge_service.rb
@@ -88,7 +88,13 @@ module MergeRequests
end
def try_merge
- repository.merge(current_user, source, merge_request, commit_message)
+ merge = repository.merge(current_user, source, merge_request, commit_message)
+
+ if merge_request.squash_on_merge? && Feature.enabled?(:persist_squash_commit_sha_for_squashes, project)
+ merge_request.update_column(:squash_commit_sha, source)
+ end
+
+ merge
rescue Gitlab::Git::PreReceiveError => e
raise MergeError,
"Something went wrong during merge pre-receive hook. #{e.message}".strip
diff --git a/app/services/merge_requests/post_merge_service.rb b/app/services/merge_requests/post_merge_service.rb
index 1c78fca3c26..17afb04ac11 100644
--- a/app/services/merge_requests/post_merge_service.rb
+++ b/app/services/merge_requests/post_merge_service.rb
@@ -15,6 +15,7 @@ module MergeRequests
todo_service.merge_merge_request(merge_request, current_user)
create_event(merge_request)
create_note(merge_request)
+ merge_request_activity_counter.track_merge_mr_action(user: current_user)
notification_service.merge_mr(merge_request, current_user)
execute_hooks(merge_request, 'merge')
invalidate_cache_counts(merge_request, users: merge_request.assignees)
diff --git a/app/services/merge_requests/reopen_service.rb b/app/services/merge_requests/reopen_service.rb
index bcedbc61c65..fde50bd959f 100644
--- a/app/services/merge_requests/reopen_service.rb
+++ b/app/services/merge_requests/reopen_service.rb
@@ -8,6 +8,7 @@ module MergeRequests
if merge_request.reopen
create_event(merge_request)
create_note(merge_request, 'reopened')
+ merge_request_activity_counter.track_reopen_mr_action(user: current_user)
notification_service.async.reopen_mr(merge_request, current_user)
execute_hooks(merge_request, 'reopen')
merge_request.reload_diff(current_user)
diff --git a/app/services/projects/unlink_fork_service.rb b/app/services/projects/unlink_fork_service.rb
index 52aea8c51a5..6ba3356d612 100644
--- a/app/services/projects/unlink_fork_service.rb
+++ b/app/services/projects/unlink_fork_service.rb
@@ -9,6 +9,8 @@ module Projects
return unless fork_network
+ log_info(message: "UnlinkForkService: Unlinking fork network", fork_network_id: fork_network.id)
+
merge_requests = fork_network
.merge_requests
.opened
@@ -16,6 +18,7 @@ module Projects
merge_requests.find_each do |mr|
::MergeRequests::CloseService.new(@project, @current_user).execute(mr)
+ log_info(message: "UnlinkForkService: Closed merge request", merge_request_id: mr.id)
end
Project.transaction do
@@ -31,6 +34,16 @@ module Projects
end
end
+ # rubocop: disable Cop/InBatches
+ Project.uncached do
+ @project.forked_to_members.in_batches do |fork_relation|
+ fork_relation.pluck(:id).each do |fork_id| # rubocop: disable CodeReuse/ActiveRecord
+ log_info(message: "UnlinkForkService: Unlinked fork of root_project", project_id: @project.id, forked_project_id: fork_id)
+ end
+ end
+ end
+ # rubocop: enable Cop/InBatches
+
# When the project getting out of the network is a node with parent
# and children, both the parent and the node needs a cache refresh.
[forked_from, @project].compact.each do |project|
diff --git a/changelogs/unreleased/292827-track-action-metrics-for-a-merge-request.yml b/changelogs/unreleased/292827-track-action-metrics-for-a-merge-request.yml
new file mode 100644
index 00000000000..8442b5838ba
--- /dev/null
+++ b/changelogs/unreleased/292827-track-action-metrics-for-a-merge-request.yml
@@ -0,0 +1,5 @@
+---
+title: Add metrics to creating, closing, reopening and merging merge requests
+merge_request: 50654
+author:
+type: other
diff --git a/changelogs/unreleased/extend-ci-minutes-reset-window.yml b/changelogs/unreleased/extend-ci-minutes-reset-window.yml
new file mode 100644
index 00000000000..1223c8e04c2
--- /dev/null
+++ b/changelogs/unreleased/extend-ci-minutes-reset-window.yml
@@ -0,0 +1,5 @@
+---
+title: Spread monthly CI minutes reset from 8 to 24 hours
+merge_request: 51084
+author:
+type: performance
diff --git a/changelogs/unreleased/security-workhorse-prometheus.yml b/changelogs/unreleased/security-workhorse-prometheus.yml
new file mode 100644
index 00000000000..ab731831033
--- /dev/null
+++ b/changelogs/unreleased/security-workhorse-prometheus.yml
@@ -0,0 +1,5 @@
+---
+title: Upgrade Workhorse to 8.58.2
+merge_request:
+author:
+type: security
diff --git a/changelogs/unreleased/sh-accelerate-s3-copy.yml b/changelogs/unreleased/sh-accelerate-s3-copy.yml
new file mode 100644
index 00000000000..4e8a35edeb2
--- /dev/null
+++ b/changelogs/unreleased/sh-accelerate-s3-copy.yml
@@ -0,0 +1,5 @@
+---
+title: Fix large S3 uploads failing to finalize
+merge_request: 50922
+author:
+type: fixed
diff --git a/config/feature_flags/development/persist_squash_commit_sha_for_squashes.yml b/config/feature_flags/development/persist_squash_commit_sha_for_squashes.yml
new file mode 100644
index 00000000000..835437278c4
--- /dev/null
+++ b/config/feature_flags/development/persist_squash_commit_sha_for_squashes.yml
@@ -0,0 +1,8 @@
+---
+name: persist_squash_commit_sha_for_squashes
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50178
+rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/294243
+milestone: '13.8'
+type: development
+group: group::source code
+default_enabled: false
diff --git a/config/feature_flags/development/s3_multithreaded_uploads.yml b/config/feature_flags/development/s3_multithreaded_uploads.yml
new file mode 100644
index 00000000000..cab1925488a
--- /dev/null
+++ b/config/feature_flags/development/s3_multithreaded_uploads.yml
@@ -0,0 +1,8 @@
+---
+name: s3_multithreaded_uploads
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50922
+rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/296772
+milestone: '13.8'
+type: development
+group: group::continuous integration
+default_enabled: true
diff --git a/config/feature_flags/development/usage_data_i_code_review_user_close_mr.yml b/config/feature_flags/development/usage_data_i_code_review_user_close_mr.yml
new file mode 100644
index 00000000000..777914da403
--- /dev/null
+++ b/config/feature_flags/development/usage_data_i_code_review_user_close_mr.yml
@@ -0,0 +1,8 @@
+---
+name: usage_data_i_code_review_user_close_mr
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50654
+rollout_issue_url:
+milestone: '13.8'
+type: development
+group: group::code review
+default_enabled: true
diff --git a/config/feature_flags/development/usage_data_i_code_review_user_create_mr.yml b/config/feature_flags/development/usage_data_i_code_review_user_create_mr.yml
new file mode 100644
index 00000000000..beb211c6f35
--- /dev/null
+++ b/config/feature_flags/development/usage_data_i_code_review_user_create_mr.yml
@@ -0,0 +1,8 @@
+---
+name: usage_data_i_code_review_user_create_mr
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50654
+rollout_issue_url:
+milestone: '13.8'
+type: development
+group: group::code review
+default_enabled: true
diff --git a/config/feature_flags/development/usage_data_i_code_review_user_merge_mr.yml b/config/feature_flags/development/usage_data_i_code_review_user_merge_mr.yml
new file mode 100644
index 00000000000..0ef596ac915
--- /dev/null
+++ b/config/feature_flags/development/usage_data_i_code_review_user_merge_mr.yml
@@ -0,0 +1,8 @@
+---
+name: usage_data_i_code_review_user_merge_mr
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50654
+rollout_issue_url:
+milestone: '13.8'
+type: development
+group: group::code review
+default_enabled: true
diff --git a/config/feature_flags/development/usage_data_i_code_review_user_reopen_mr.yml b/config/feature_flags/development/usage_data_i_code_review_user_reopen_mr.yml
new file mode 100644
index 00000000000..9a5c2ecc26a
--- /dev/null
+++ b/config/feature_flags/development/usage_data_i_code_review_user_reopen_mr.yml
@@ -0,0 +1,8 @@
+---
+name: usage_data_i_code_review_user_reopen_mr
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50654
+rollout_issue_url:
+milestone: '13.8'
+type: development
+group: group::code review
+default_enabled: true
diff --git a/config/initializers/carrierwave_patch.rb b/config/initializers/carrierwave_patch.rb
index ad3ff36138f..a5102696251 100644
--- a/config/initializers/carrierwave_patch.rb
+++ b/config/initializers/carrierwave_patch.rb
@@ -17,7 +17,22 @@ module CarrierWave
class Fog < Abstract
class File
def copy_to(new_path)
- connection.copy_object(@uploader.fog_directory, file.key, @uploader.fog_directory, new_path, copy_to_options)
+ # fog-aws needs multipart uploads to copy files above 5 GB,
+ # and it is currently the only Fog provider that supports
+ # multithreaded uploads (https://github.com/fog/fog-aws/pull/579).
+ # Multithreaded uploads are essential for copying large amounts of data
+ # within the request timeout.
+ if ::Feature.enabled?(:s3_multithreaded_uploads, default_enabled: true) && fog_provider == 'AWS'
+ file.concurrency = 10 # AWS SDK uses 10 threads by default
+ file.copy(@uploader.fog_directory, new_path, copy_to_options)
+ else
+ # Some Fog providers may issue a GET request (https://github.com/fog/fog-google/issues/512)
+ # instead of a HEAD request after the transfer completes,
+ # which might cause the file to be downloaded locally.
+ # We fallback to the original copy_object for non-AWS providers.
+ connection.copy_object(@uploader.fog_directory, file.key, @uploader.fog_directory, new_path, copy_to_options)
+ end
+
CarrierWave::Storage::Fog::File.new(@uploader, @base, new_path)
end
diff --git a/db/migrate/20201222151823_update_trusted_apps_to_confidential.rb b/db/migrate/20201222151823_update_trusted_apps_to_confidential.rb
new file mode 100644
index 00000000000..bcb94c65125
--- /dev/null
+++ b/db/migrate/20201222151823_update_trusted_apps_to_confidential.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class UpdateTrustedAppsToConfidential < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'tmp_index_oauth_applications_on_id_where_trusted'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :oauth_applications, :id, where: 'trusted = true', name: INDEX_NAME
+
+ execute('UPDATE oauth_applications SET confidential = true WHERE trusted = true')
+ end
+
+ def down
+ # We won't be able to tell which trusted applications weren't confidential before the migration
+ # and setting all trusted applications are not confidential would introduce security issues
+
+ remove_concurrent_index_by_name :oauth_applications, INDEX_NAME
+ end
+end
diff --git a/db/schema_migrations/20201222151823 b/db/schema_migrations/20201222151823
new file mode 100644
index 00000000000..914e96473a0
--- /dev/null
+++ b/db/schema_migrations/20201222151823
@@ -0,0 +1 @@
+d3af120a74b4c55345ac7fb524395251cd3c1b3cd9685f711196a134f427845c \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 8732dd74732..27c5d33f773 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -23105,6 +23105,10 @@ CREATE INDEX temporary_index_vulnerabilities_on_id ON vulnerabilities USING btre
CREATE UNIQUE INDEX term_agreements_unique_index ON term_agreements USING btree (user_id, term_id);
+CREATE INDEX tmp_index_for_email_unconfirmation_migration ON emails USING btree (id) WHERE (confirmed_at IS NOT NULL);
+
+CREATE INDEX tmp_index_oauth_applications_on_id_where_trusted ON oauth_applications USING btree (id) WHERE (trusted = true);
+
CREATE INDEX tmp_index_on_vulnerabilities_non_dismissed ON vulnerabilities USING btree (id) WHERE (state <> 2);
CREATE UNIQUE INDEX unique_merge_request_metrics_by_merge_request_id ON merge_request_metrics USING btree (merge_request_id);
diff --git a/doc/administration/compliance.md b/doc/administration/compliance.md
index 14b7dee24b4..6079e838ac6 100644
--- a/doc/administration/compliance.md
+++ b/doc/administration/compliance.md
@@ -23,7 +23,7 @@ relevant compliance standards.
|**[Lock project membership to group](../user/group/index.md#member-lock)**<br>Group owners can prevent new members from being added to projects within a group.|Starter+|✓|Group|
|**[LDAP group sync](auth/ldap/index.md#group-sync)**<br>GitLab Enterprise Edition gives admins the ability to automatically sync groups and manage SSH keys, permissions, and authentication, so you can focus on building your product, not configuring your tools.|Starter+||Instance|
|**[LDAP group sync filters](auth/ldap/index.md#group-sync)**<br>GitLab Enterprise Edition Premium gives more flexibility to synchronize with LDAP based on filters, meaning you can leverage LDAP attributes to map GitLab permissions.|Premium+||Instance|
-|**[Audit events](audit_events.md)**<br>To maintain the integrity of your code, GitLab Enterprise Edition Premium gives admins the ability to view any modifications made within the GitLab server in an advanced audit events system, so you can control, analyze, and track every change.|Premium+||Instance, Group, Project|
+|**[Audit events](audit_events.md)**<br>To maintain the integrity of your code, GitLab Enterprise Edition Premium gives admins the ability to view any modifications made within the GitLab server in an advanced audit events system, so you can control, analyze, and track every change.|Premium+|✓|Instance, Group, Project|
|**[Auditor users](auditor_users.md)**<br>Auditor users are users who are given read-only access to all projects, groups, and other resources on the GitLab instance.|Premium+||Instance|
|**[Credentials inventory](../user/admin_area/credentials_inventory.md)**<br>With a credentials inventory, GitLab administrators can keep track of the credentials used by all of the users in their GitLab instance. |Ultimate||Instance|
-|**Separation of Duties using [Protected branches](../user/project/protected_branches.md#protected-branches-approval-by-code-owners) and [custom CI Configuration Paths](../ci/pipelines/settings.md#custom-ci-configuration-path)**<br> GitLab Silver and Premium users can leverage the GitLab cross-project YAML configurations to define deployers of code and developers of code. View the [Separation of Duties Deploy Project](https://gitlab.com/guided-explorations/separation-of-duties-deploy/blob/master/README.md) and [Separation of Duties Project](https://gitlab.com/guided-explorations/separation-of-duties/blob/master/README.md) to see how to use this set up to define these roles.|Premium+||Project|
+|**Separation of Duties using [Protected branches](../user/project/protected_branches.md#protected-branches-approval-by-code-owners) and [custom CI Configuration Paths](../ci/pipelines/settings.md#custom-ci-configuration-path)**<br> GitLab Silver and Premium users can leverage the GitLab cross-project YAML configurations to define deployers of code and developers of code. View the [Separation of Duties Deploy Project](https://gitlab.com/guided-explorations/separation-of-duties-deploy/blob/master/README.md) and [Separation of Duties Project](https://gitlab.com/guided-explorations/separation-of-duties/blob/master/README.md) to see how to use this set up to define these roles.|Premium+|✓|Project|
diff --git a/doc/user/project/integrations/img/webhooks_ssl.png b/doc/user/project/integrations/img/webhooks_ssl.png
deleted file mode 100644
index e5777a2e99b..00000000000
--- a/doc/user/project/integrations/img/webhooks_ssl.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/integrations/webhooks.md b/doc/user/project/integrations/webhooks.md
index 6702b48d0de..6cf7e1f30a3 100644
--- a/doc/user/project/integrations/webhooks.md
+++ b/doc/user/project/integrations/webhooks.md
@@ -28,32 +28,15 @@ notify bug tracking systems.
Webhooks can be used to update an external issue tracker, trigger CI jobs,
update a backup mirror, or even deploy to your production server.
-They are available **per project** for GitLab Community Edition,
-and **per project and per group** for **GitLab Enterprise Edition**.
-Navigate to the webhooks page at your project's **Settings > Webhooks**.
+Webhooks are available:
+
+- Per project, at a project's **Settings > Webhooks** menu. **(CORE)**
+- Additionally per group, at a group's **Settings > Webhooks** menu. **(PREMIUM)**
NOTE:
On GitLab.com, the [maximum number of webhooks and their size](../../../user/gitlab_com/index.md#webhooks) per project, and per group, is limited.
-## Version history
-
-Starting from GitLab 8.5:
-
-- the `repository` key is deprecated in favor of the `project` key
-- the `project.ssh_url` key is deprecated in favor of the `project.git_ssh_url` key
-- the `project.http_url` key is deprecated in favor of the `project.git_http_url` key
-
-Starting from GitLab 11.1, the logs of webhooks are automatically removed after
-one month.
-
-Starting from GitLab 11.2:
-
-- The `description` field for issues, merge requests, comments, and wiki pages
- is rewritten so that simple Markdown image references (like
- `![](/uploads/...)`) have their target URL changed to an absolute URL. See
- [image URL rewriting](#image-url-rewriting) for more details.
-
## Possible uses for webhooks
- You can set up a webhook in GitLab to send a notification to
@@ -91,8 +74,6 @@ be self-signed.
You can turn this off in the webhook settings in your GitLab projects.
-![SSL Verification](img/webhooks_ssl.png)
-
## Branch filtering
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/20338) in GitLab 11.3.
@@ -1362,7 +1343,7 @@ X-Gitlab-Event: Deployment Hook
Note that `deployable_id` is the ID of the CI job.
-### Member events **(PREMIUM)**
+### Group member events **(PREMIUM)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/260347) in GitLab 13.7.
@@ -1554,7 +1535,7 @@ Markdown features, like link labels.
## Testing webhooks
You can trigger the webhook manually. Sample data from the project is used.
-> For example: for triggering `Push Events` your project should have at least one commit.
+For example, for triggering `Push Events` your project should have at least one commit.
![Webhook testing](img/webhook_testing.png)
diff --git a/doc/user/project/issues/csv_export.md b/doc/user/project/issues/csv_export.md
index 023a8ee57bc..e7cd1377603 100644
--- a/doc/user/project/issues/csv_export.md
+++ b/doc/user/project/issues/csv_export.md
@@ -53,7 +53,7 @@ Exported issues are always sorted by `Issue ID`.
>
> **Weight** and **Locked** columns were [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/5300) in GitLab Starter 10.8.
-Data wis encoded with a comma as the column delimiter, with `"` used to quote fields if needed, and newlines to separate rows. The first row contains the headers, which are listed in the following table along with a description of the values:
+Data is encoded with a comma as the column delimiter, with `"` used to quote fields if needed, and newlines to separate rows. The first row contains the headers, which are listed in the following table along with a description of the values:
| Column | Description |
|---------|-------------|
diff --git a/lib/api/concerns/packages/nuget_endpoints.rb b/lib/api/concerns/packages/nuget_endpoints.rb
index 70760bf048f..53b778875fc 100644
--- a/lib/api/concerns/packages/nuget_endpoints.rb
+++ b/lib/api/concerns/packages/nuget_endpoints.rb
@@ -15,7 +15,7 @@ module API
extend ActiveSupport::Concern
POSITIVE_INTEGER_REGEX = %r{\A[1-9]\d*\z}.freeze
- NON_NEGATIVE_INTEGER_REGEX = %r{\A0|[1-9]\d*\z}.freeze
+ NON_NEGATIVE_INTEGER_REGEX = %r{\A(0|[1-9]\d*)\z}.freeze
included do
helpers do
diff --git a/lib/gitlab/error_tracking.rb b/lib/gitlab/error_tracking.rb
index e6877d73cf8..1a8e5aaf07a 100644
--- a/lib/gitlab/error_tracking.rb
+++ b/lib/gitlab/error_tracking.rb
@@ -186,14 +186,6 @@ module Gitlab
def inject_context_for_exception(event, ex)
case ex
- when ActiveModel::MissingAttributeError # Debugging for https://gitlab.com/gitlab-org/gitlab/-/issues/26751
- columns_hash = ActiveRecord::Base
- .connection
- .schema_cache
- .instance_variable_get(:@columns_hash)
- .transform_values { |v| v.map(&:first) }
-
- event.extra.merge!(columns_hash)
when ActiveRecord::StatementInvalid
event.extra[:sql] = PgQuery.normalize(ex.sql.to_s)
else
diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb
index 4ae6297f6f5..96f2b7570b3 100644
--- a/lib/gitlab/regex.rb
+++ b/lib/gitlab/regex.rb
@@ -27,7 +27,18 @@ module Gitlab
end
def package_name_regex
- @package_name_regex ||= %r{\A\@?(([\w\-\.\+]*)\/)*([\w\-\.]+)@?(([\w\-\.\+]*)\/)*([\w\-\.]*)\z}.freeze
+ @package_name_regex ||=
+ %r{
+ \A\@?
+ (?> # atomic group to prevent backtracking
+ (([\w\-\.\+]*)\/)*([\w\-\.]+)
+ )
+ @?
+ (?> # atomic group to prevent backtracking
+ (([\w\-\.\+]*)\/)*([\w\-\.]*)
+ )
+ \z
+ }x.freeze
end
def maven_file_name_regex
diff --git a/lib/gitlab/usage_data_counters/known_events/common.yml b/lib/gitlab/usage_data_counters/known_events/common.yml
index ced8e6b53a6..fdbbbc7a029 100644
--- a/lib/gitlab/usage_data_counters/known_events/common.yml
+++ b/lib/gitlab/usage_data_counters/known_events/common.yml
@@ -425,6 +425,7 @@
redis_slot: snippets
aggregation: weekly
feature_flag: usage_data_i_snippets_show
+# Merge request counters
- name: i_code_review_mr_diffs
redis_slot: code_review
category: code_review
@@ -440,6 +441,26 @@
category: code_review
aggregation: weekly
feature_flag: usage_data_i_code_review_mr_single_file_diffs
+- name: i_code_review_user_create_mr
+ redis_slot: code_review
+ category: code_review
+ aggregation: weekly
+ feature_flag: usage_data_i_code_review_user_create_mr
+- name: i_code_review_user_close_mr
+ redis_slot: code_review
+ category: code_review
+ aggregation: weekly
+ feature_flag: usage_data_i_code_review_user_close_mr
+- name: i_code_review_user_reopen_mr
+ redis_slot: code_review
+ category: code_review
+ aggregation: weekly
+ feature_flag: usage_data_i_code_review_user_reopen_mr
+- name: i_code_review_user_merge_mr
+ redis_slot: code_review
+ category: code_review
+ aggregation: weekly
+ feature_flag: usage_data_i_code_review_user_merge_mr
# Terraform
- name: p_terraform_state_api_unique_users
category: terraform
diff --git a/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter.rb b/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter.rb
index ef90370ce2d..695471fa2cc 100644
--- a/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter.rb
+++ b/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter.rb
@@ -6,6 +6,10 @@ module Gitlab
MR_DIFFS_ACTION = 'i_code_review_mr_diffs'
MR_DIFFS_SINGLE_FILE_ACTION = 'i_code_review_mr_single_file_diffs'
MR_DIFFS_USER_SINGLE_FILE_ACTION = 'i_code_review_user_single_file_diffs'
+ MR_CREATE_ACTION = 'i_code_review_user_create_mr'
+ MR_CLOSE_ACTION = 'i_code_review_user_close_mr'
+ MR_REOPEN_ACTION = 'i_code_review_user_reopen_mr'
+ MR_MERGE_ACTION = 'i_code_review_user_merge_mr'
class << self
def track_mr_diffs_action(merge_request:)
@@ -17,6 +21,22 @@ module Gitlab
track_unique_action_by_user(MR_DIFFS_USER_SINGLE_FILE_ACTION, user)
end
+ def track_create_mr_action(user:)
+ track_unique_action_by_user(MR_CREATE_ACTION, user)
+ end
+
+ def track_close_mr_action(user:)
+ track_unique_action_by_user(MR_CLOSE_ACTION, user)
+ end
+
+ def track_merge_mr_action(user:)
+ track_unique_action_by_user(MR_MERGE_ACTION, user)
+ end
+
+ def track_reopen_mr_action(user:)
+ track_unique_action_by_user(MR_REOPEN_ACTION, user)
+ end
+
private
def track_unique_action_by_merge_request(action, merge_request)
diff --git a/qa/qa/page/project/job/show.rb b/qa/qa/page/project/job/show.rb
index 2ecb27e05b2..8c70d0874c4 100644
--- a/qa/qa/page/project/job/show.rb
+++ b/qa/qa/page/project/job/show.rb
@@ -12,7 +12,7 @@ module QA
end
view 'app/assets/javascripts/jobs/components/stages_dropdown.vue' do
- element :pipeline_path
+ element :pipeline_path, required: true
end
view 'app/assets/javascripts/jobs/components/sidebar.vue' do
diff --git a/qa/qa/page/project/pipeline/show.rb b/qa/qa/page/project/pipeline/show.rb
index 7f96b896c1d..994b1c02a3d 100644
--- a/qa/qa/page/project/pipeline/show.rb
+++ b/qa/qa/page/project/pipeline/show.rb
@@ -77,7 +77,7 @@ module QA
end
def click_job(job_name)
- click_element(:job_link, text: job_name)
+ click_element(:job_link, Project::Job::Show, text: job_name)
end
def expand_child_pipeline
diff --git a/qa/qa/specs/features/browser_ui/6_release/pages/pages_pipeline_spec.rb b/qa/qa/specs/features/browser_ui/6_release/pages/pages_pipeline_spec.rb
new file mode 100644
index 00000000000..3b8cf97c3e8
--- /dev/null
+++ b/qa/qa/specs/features/browser_ui/6_release/pages/pages_pipeline_spec.rb
@@ -0,0 +1,45 @@
+# frozen_string_literal: true
+
+module QA
+ RSpec.describe 'Release', :smoke, :runner do
+ describe 'Pages' do
+ let!(:project) do
+ Resource::Project.fabricate_via_api! do |project|
+ project.name = 'jekyll-pages-project'
+ project.template_name = :jekyll
+ end
+ end
+
+ let(:pipeline) do
+ Resource::Pipeline.fabricate_via_api! do |pipeline|
+ pipeline.project = project
+ pipeline.variables =
+ { key: :CI_PAGES_DOMAIN, value: 'nip.io', variable_type: :env_var },
+ { key: :CI_PAGES_URL, value: 'http://127.0.0.1.nip.io', variable_type: :env_var }
+ end
+ end
+
+ before do
+ Flow::Login.sign_in
+
+ Resource::Runner.fabricate_via_api! do |runner|
+ runner.project = project
+ runner.executor = :docker
+ end
+
+ pipeline.visit!
+ end
+
+ it 'runs a Pages-specific pipeline' do
+ Page::Project::Pipeline::Show.perform do |show|
+ expect(show).to have_job(:pages)
+ show.click_job(:pages)
+ end
+
+ Page::Project::Job::Show.perform do |show|
+ expect(show).to have_passed
+ end
+ end
+ end
+ end
+end
diff --git a/spec/controllers/oauth/authorizations_controller_spec.rb b/spec/controllers/oauth/authorizations_controller_spec.rb
index 23d472f6853..f811f13def8 100644
--- a/spec/controllers/oauth/authorizations_controller_spec.rb
+++ b/spec/controllers/oauth/authorizations_controller_spec.rb
@@ -95,6 +95,20 @@ RSpec.describe Oauth::AuthorizationsController do
subject { post :create, params: params }
include_examples 'OAuth Authorizations require confirmed user'
+
+ context 'when application is confidential' do
+ before do
+ application.update(confidential: true)
+ params[:response_type] = 'token'
+ end
+
+ it 'does not allow the implicit flow' do
+ subject
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(response).to render_template('doorkeeper/authorizations/error')
+ end
+ end
end
describe 'DELETE #destroy' do
diff --git a/spec/controllers/projects/raw_controller_spec.rb b/spec/controllers/projects/raw_controller_spec.rb
index dfe7ba34e6d..b1c3c1c0276 100644
--- a/spec/controllers/projects/raw_controller_spec.rb
+++ b/spec/controllers/projects/raw_controller_spec.rb
@@ -250,6 +250,18 @@ RSpec.describe Projects::RawController do
expect(response.cache_control[:no_store]).to be_nil
end
+ context 'when a public project has private repo' do
+ let(:project) { create(:project, :public, :repository, :repository_private) }
+ let(:user) { create(:user, maintainer_projects: [project]) }
+
+ it 'does not set public caching header' do
+ sign_in user
+ request_file
+
+ expect(response.header['Cache-Control']).to include('max-age=60, private')
+ end
+ end
+
context 'when If-None-Match header is set' do
it 'returns a 304 status' do
request_file
diff --git a/spec/controllers/projects/repositories_controller_spec.rb b/spec/controllers/projects/repositories_controller_spec.rb
index e7f4a8a1422..e6327a72a68 100644
--- a/spec/controllers/projects/repositories_controller_spec.rb
+++ b/spec/controllers/projects/repositories_controller_spec.rb
@@ -137,6 +137,18 @@ RSpec.describe Projects::RepositoriesController do
expect(response.header['ETag']).to be_present
expect(response.header['Cache-Control']).to include('max-age=60, public')
end
+
+ context 'and repo is private' do
+ let(:project) { create(:project, :repository, :public, :repository_private) }
+
+ it 'sets appropriate caching headers' do
+ get_archive
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(response.header['ETag']).to be_present
+ expect(response.header['Cache-Control']).to include('max-age=60, private')
+ end
+ end
end
context 'when ref is a commit SHA' do
diff --git a/spec/initializers/carrierwave_patch_spec.rb b/spec/initializers/carrierwave_patch_spec.rb
index c4a7bfa59c6..efe13f0eece 100644
--- a/spec/initializers/carrierwave_patch_spec.rb
+++ b/spec/initializers/carrierwave_patch_spec.rb
@@ -6,38 +6,87 @@ RSpec.describe 'CarrierWave::Storage::Fog::File' do
let(:uploader_class) { Class.new(CarrierWave::Uploader::Base) }
let(:uploader) { uploader_class.new }
let(:storage) { CarrierWave::Storage::Fog.new(uploader) }
- let(:azure_options) do
- {
- azure_storage_account_name: 'AZURE_ACCOUNT_NAME',
- azure_storage_access_key: 'AZURE_ACCESS_KEY',
- provider: 'AzureRM'
- }
- end
+ let(:bucket_name) { 'some-bucket' }
+ let(:connection) { ::Fog::Storage.new(connection_options) }
+ let(:bucket) { connection.directories.new(key: bucket_name )}
+ let(:test_filename) { 'test' }
+ let(:test_data) { File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml')) }
- subject { CarrierWave::Storage::Fog::File.new(uploader, storage, 'test') }
+ subject { CarrierWave::Storage::Fog::File.new(uploader, storage, test_filename) }
before do
require 'fog/azurerm'
- allow(uploader).to receive(:fog_credentials).and_return(azure_options)
- Fog.mock!
+ require 'fog/aws'
+
+ stub_object_storage(connection_params: connection_options, remote_directory: bucket_name)
+
+ allow(uploader).to receive(:fog_directory).and_return(bucket_name)
+ allow(uploader).to receive(:fog_credentials).and_return(connection_options)
+
+ bucket.files.create(key: test_filename, body: test_data) # rubocop:disable Rails/SaveBang
end
- describe '#authenticated_url' do
- context 'with Azure' do
+ context 'AWS' do
+ let(:connection_options) do
+ {
+ provider: 'AWS',
+ aws_access_key_id: 'AWS_ACCESS_KEY',
+ aws_secret_access_key: 'AWS_SECRET_KEY'
+ }
+ end
+
+ describe '#copy_to' do
+ let(:dest_filename) { 'copied.txt'}
+
+ it 'copies the file' do
+ result = subject.copy_to(dest_filename)
+
+ expect(result.exists?).to be true
+ expect(result.read).to eq(test_data)
+
+ # Sanity check that the file actually is there
+ copied = bucket.files.get(dest_filename)
+ expect(copied).to be_present
+ expect(copied.body).to eq(test_data)
+ end
+ end
+ end
+
+ context 'Azure' do
+ let(:connection_options) do
+ {
+ provider: 'AzureRM',
+ azure_storage_account_name: 'AZURE_ACCOUNT_NAME',
+ azure_storage_access_key: 'AZURE_ACCESS_KEY'
+ }
+ end
+
+ describe '#copy_to' do
+ let(:dest_filename) { 'copied.txt'}
+
+ it 'copies the file' do
+ result = subject.copy_to(dest_filename)
+
+ # Fog Azure provider doesn't mock the actual copied data
+ expect(result.exists?).to be true
+ end
+ end
+
+ describe '#authenticated_url' do
it 'has an authenticated URL' do
expect(subject.authenticated_url).to eq("https://sa.blob.core.windows.net/test_container/test_blob?token")
end
- end
- context 'with custom expire_at' do
- it 'properly sets expires param' do
- expire_at = 24.hours.from_now
+ context 'with custom expire_at' do
+ it 'properly sets expires param' do
+ expire_at = 24.hours.from_now
- expect_next_instance_of(Fog::Storage::AzureRM::File) do |file|
- expect(file).to receive(:url).with(expire_at).and_call_original
- end
+ expect_next_instance_of(Fog::Storage::AzureRM::File) do |file|
+ expect(file).to receive(:url).with(expire_at).and_call_original
+ end
- expect(subject.authenticated_url(expire_at: expire_at)).to eq("https://sa.blob.core.windows.net/test_container/test_blob?token")
+ expect(subject.authenticated_url(expire_at: expire_at)).to eq("https://sa.blob.core.windows.net/test_container/test_blob?token")
+ end
end
end
end
diff --git a/spec/lib/gitlab/regex_spec.rb b/spec/lib/gitlab/regex_spec.rb
index ebb37f45b95..776ca81a338 100644
--- a/spec/lib/gitlab/regex_spec.rb
+++ b/spec/lib/gitlab/regex_spec.rb
@@ -292,6 +292,12 @@ RSpec.describe Gitlab::Regex do
it { is_expected.not_to match('my package name') }
it { is_expected.not_to match('!!()()') }
it { is_expected.not_to match("..\n..\foo") }
+
+ it 'has no backtracking issue' do
+ Timeout.timeout(1) do
+ expect(subject).not_to match("-" * 50000 + ";")
+ end
+ end
end
describe '.maven_file_name_regex' do
diff --git a/spec/lib/gitlab/sidekiq_middleware_spec.rb b/spec/lib/gitlab/sidekiq_middleware_spec.rb
index 4ee9569a0cf..b632fc8bad2 100644
--- a/spec/lib/gitlab/sidekiq_middleware_spec.rb
+++ b/spec/lib/gitlab/sidekiq_middleware_spec.rb
@@ -100,7 +100,7 @@ RSpec.describe Gitlab::SidekiqMiddleware do
"subject",
"body"
],
- "_aj_symbol_keys" => ["args"]
+ ActiveJob::Arguments.const_get('RUBY2_KEYWORDS_KEY', false) => ["args"]
}
],
"executions" => 0,
diff --git a/spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb b/spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb
index ecead53abf2..27bc4310200 100644
--- a/spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb
+++ b/spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb
@@ -39,4 +39,36 @@ RSpec.describe Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter, :cl
let(:action) { described_class::MR_DIFFS_USER_SINGLE_FILE_ACTION }
end
end
+
+ describe '.track_create_mr_action' do
+ subject { described_class.track_create_mr_action(user: user) }
+
+ it_behaves_like 'a tracked merge request unique event' do
+ let(:action) { described_class::MR_CREATE_ACTION }
+ end
+ end
+
+ describe '.track_close_mr_action' do
+ subject { described_class.track_close_mr_action(user: user) }
+
+ it_behaves_like 'a tracked merge request unique event' do
+ let(:action) { described_class::MR_CLOSE_ACTION }
+ end
+ end
+
+ describe '.track_merge_mr_action' do
+ subject { described_class.track_merge_mr_action(user: user) }
+
+ it_behaves_like 'a tracked merge request unique event' do
+ let(:action) { described_class::MR_MERGE_ACTION }
+ end
+ end
+
+ describe '.track_reopen_mr_action' do
+ subject { described_class.track_reopen_mr_action(user: user) }
+
+ it_behaves_like 'a tracked merge request unique event' do
+ let(:action) { described_class::MR_REOPEN_ACTION }
+ end
+ end
end
diff --git a/spec/rubocop/cop/active_record_association_reload_spec.rb b/spec/rubocop/cop/active_record_association_reload_spec.rb
index e8d46064b49..8dbe6daeeca 100644
--- a/spec/rubocop/cop/active_record_association_reload_spec.rb
+++ b/spec/rubocop/cop/active_record_association_reload_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../rubocop/cop/active_record_association_reload'
-RSpec.describe RuboCop::Cop::ActiveRecordAssociationReload, type: :rubocop do
+RSpec.describe RuboCop::Cop::ActiveRecordAssociationReload do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/api/base_spec.rb b/spec/rubocop/cop/api/base_spec.rb
index 893bcf49627..de05ab93874 100644
--- a/spec/rubocop/cop/api/base_spec.rb
+++ b/spec/rubocop/cop/api/base_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/api/base'
-RSpec.describe RuboCop::Cop::API::Base, type: :rubocop do
+RSpec.describe RuboCop::Cop::API::Base do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/avoid_becomes_spec.rb b/spec/rubocop/cop/avoid_becomes_spec.rb
index 3e3e3abc27d..07cf374faf5 100644
--- a/spec/rubocop/cop/avoid_becomes_spec.rb
+++ b/spec/rubocop/cop/avoid_becomes_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../rubocop/cop/avoid_becomes'
-RSpec.describe RuboCop::Cop::AvoidBecomes, type: :rubocop do
+RSpec.describe RuboCop::Cop::AvoidBecomes do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/avoid_break_from_strong_memoize_spec.rb b/spec/rubocop/cop/avoid_break_from_strong_memoize_spec.rb
index 4fb47e758bb..3c3aa5b7b5c 100644
--- a/spec/rubocop/cop/avoid_break_from_strong_memoize_spec.rb
+++ b/spec/rubocop/cop/avoid_break_from_strong_memoize_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../rubocop/cop/avoid_break_from_strong_memoize'
-RSpec.describe RuboCop::Cop::AvoidBreakFromStrongMemoize, type: :rubocop do
+RSpec.describe RuboCop::Cop::AvoidBreakFromStrongMemoize do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/avoid_keyword_arguments_in_sidekiq_workers_spec.rb b/spec/rubocop/cop/avoid_keyword_arguments_in_sidekiq_workers_spec.rb
index 851493e004e..1e1fe851840 100644
--- a/spec/rubocop/cop/avoid_keyword_arguments_in_sidekiq_workers_spec.rb
+++ b/spec/rubocop/cop/avoid_keyword_arguments_in_sidekiq_workers_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../rubocop/cop/avoid_keyword_arguments_in_sidekiq_workers'
-RSpec.describe RuboCop::Cop::AvoidKeywordArgumentsInSidekiqWorkers, type: :rubocop do
+RSpec.describe RuboCop::Cop::AvoidKeywordArgumentsInSidekiqWorkers do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/avoid_return_from_blocks_spec.rb b/spec/rubocop/cop/avoid_return_from_blocks_spec.rb
index a157183646c..71311b9df7f 100644
--- a/spec/rubocop/cop/avoid_return_from_blocks_spec.rb
+++ b/spec/rubocop/cop/avoid_return_from_blocks_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../rubocop/cop/avoid_return_from_blocks'
-RSpec.describe RuboCop::Cop::AvoidReturnFromBlocks, type: :rubocop do
+RSpec.describe RuboCop::Cop::AvoidReturnFromBlocks do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/avoid_route_redirect_leading_slash_spec.rb b/spec/rubocop/cop/avoid_route_redirect_leading_slash_spec.rb
index 78bc859beda..9e13a5278e3 100644
--- a/spec/rubocop/cop/avoid_route_redirect_leading_slash_spec.rb
+++ b/spec/rubocop/cop/avoid_route_redirect_leading_slash_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../rubocop/cop/avoid_route_redirect_leading_slash'
-RSpec.describe RuboCop::Cop::AvoidRouteRedirectLeadingSlash, type: :rubocop do
+RSpec.describe RuboCop::Cop::AvoidRouteRedirectLeadingSlash do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/ban_catch_throw_spec.rb b/spec/rubocop/cop/ban_catch_throw_spec.rb
index 1d0ccb6d262..4f669bad4af 100644
--- a/spec/rubocop/cop/ban_catch_throw_spec.rb
+++ b/spec/rubocop/cop/ban_catch_throw_spec.rb
@@ -7,7 +7,7 @@ require 'rubocop/rspec/support'
require_relative '../../../rubocop/cop/ban_catch_throw'
-RSpec.describe RuboCop::Cop::BanCatchThrow, type: :rubocop do
+RSpec.describe RuboCop::Cop::BanCatchThrow do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/code_reuse/finder_spec.rb b/spec/rubocop/cop/code_reuse/finder_spec.rb
index 1935d825b19..6f04d5e0d60 100644
--- a/spec/rubocop/cop/code_reuse/finder_spec.rb
+++ b/spec/rubocop/cop/code_reuse/finder_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/code_reuse/finder'
-RSpec.describe RuboCop::Cop::CodeReuse::Finder, type: :rubocop do
+RSpec.describe RuboCop::Cop::CodeReuse::Finder do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/code_reuse/presenter_spec.rb b/spec/rubocop/cop/code_reuse/presenter_spec.rb
index 1366018ec12..8efd4da8aa1 100644
--- a/spec/rubocop/cop/code_reuse/presenter_spec.rb
+++ b/spec/rubocop/cop/code_reuse/presenter_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/code_reuse/presenter'
-RSpec.describe RuboCop::Cop::CodeReuse::Presenter, type: :rubocop do
+RSpec.describe RuboCop::Cop::CodeReuse::Presenter do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/code_reuse/serializer_spec.rb b/spec/rubocop/cop/code_reuse/serializer_spec.rb
index d4341cc0367..74999df5859 100644
--- a/spec/rubocop/cop/code_reuse/serializer_spec.rb
+++ b/spec/rubocop/cop/code_reuse/serializer_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/code_reuse/serializer'
-RSpec.describe RuboCop::Cop::CodeReuse::Serializer, type: :rubocop do
+RSpec.describe RuboCop::Cop::CodeReuse::Serializer do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/code_reuse/service_class_spec.rb b/spec/rubocop/cop/code_reuse/service_class_spec.rb
index b018e743230..4870daf72dc 100644
--- a/spec/rubocop/cop/code_reuse/service_class_spec.rb
+++ b/spec/rubocop/cop/code_reuse/service_class_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/code_reuse/service_class'
-RSpec.describe RuboCop::Cop::CodeReuse::ServiceClass, type: :rubocop do
+RSpec.describe RuboCop::Cop::CodeReuse::ServiceClass do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/code_reuse/worker_spec.rb b/spec/rubocop/cop/code_reuse/worker_spec.rb
index 1f502e554c4..9e015f286d8 100644
--- a/spec/rubocop/cop/code_reuse/worker_spec.rb
+++ b/spec/rubocop/cop/code_reuse/worker_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/code_reuse/worker'
-RSpec.describe RuboCop::Cop::CodeReuse::Worker, type: :rubocop do
+RSpec.describe RuboCop::Cop::CodeReuse::Worker do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/default_scope_spec.rb b/spec/rubocop/cop/default_scope_spec.rb
index 617a7f63497..fee1895603c 100644
--- a/spec/rubocop/cop/default_scope_spec.rb
+++ b/spec/rubocop/cop/default_scope_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../rubocop/cop/default_scope'
-RSpec.describe RuboCop::Cop::DefaultScope, type: :rubocop do
+RSpec.describe RuboCop::Cop::DefaultScope do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/destroy_all_spec.rb b/spec/rubocop/cop/destroy_all_spec.rb
index 3220d44ea2b..df664724a91 100644
--- a/spec/rubocop/cop/destroy_all_spec.rb
+++ b/spec/rubocop/cop/destroy_all_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../rubocop/cop/destroy_all'
-RSpec.describe RuboCop::Cop::DestroyAll, type: :rubocop do
+RSpec.describe RuboCop::Cop::DestroyAll do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/filename_length_spec.rb b/spec/rubocop/cop/filename_length_spec.rb
index 381218c61ed..2411c8dbc7b 100644
--- a/spec/rubocop/cop/filename_length_spec.rb
+++ b/spec/rubocop/cop/filename_length_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../rubocop/cop/filename_length'
-RSpec.describe RuboCop::Cop::FilenameLength, type: :rubocop do
+RSpec.describe RuboCop::Cop::FilenameLength do
subject(:cop) { described_class.new }
it 'does not flag files with names 100 characters long' do
diff --git a/spec/rubocop/cop/gitlab/avoid_uploaded_file_from_params_spec.rb b/spec/rubocop/cop/gitlab/avoid_uploaded_file_from_params_spec.rb
index 8341b0cab3a..2db03898e01 100644
--- a/spec/rubocop/cop/gitlab/avoid_uploaded_file_from_params_spec.rb
+++ b/spec/rubocop/cop/gitlab/avoid_uploaded_file_from_params_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/gitlab/avoid_uploaded_file_from_params'
-RSpec.describe RuboCop::Cop::Gitlab::AvoidUploadedFileFromParams, type: :rubocop do
+RSpec.describe RuboCop::Cop::Gitlab::AvoidUploadedFileFromParams do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/gitlab/bulk_insert_spec.rb b/spec/rubocop/cop/gitlab/bulk_insert_spec.rb
index d1236865897..ad7e685e505 100644
--- a/spec/rubocop/cop/gitlab/bulk_insert_spec.rb
+++ b/spec/rubocop/cop/gitlab/bulk_insert_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/gitlab/bulk_insert'
-RSpec.describe RuboCop::Cop::Gitlab::BulkInsert, type: :rubocop do
+RSpec.describe RuboCop::Cop::Gitlab::BulkInsert do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/gitlab/change_timezone_spec.rb b/spec/rubocop/cop/gitlab/change_timezone_spec.rb
index 1ec5f28e811..6abbc06bb1a 100644
--- a/spec/rubocop/cop/gitlab/change_timezone_spec.rb
+++ b/spec/rubocop/cop/gitlab/change_timezone_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/gitlab/change_timzone'
-RSpec.describe RuboCop::Cop::Gitlab::ChangeTimezone, type: :rubocop do
+RSpec.describe RuboCop::Cop::Gitlab::ChangeTimezone do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/gitlab/const_get_inherit_false_spec.rb b/spec/rubocop/cop/gitlab/const_get_inherit_false_spec.rb
index 97ed6b743f9..bed06ab2b17 100644
--- a/spec/rubocop/cop/gitlab/const_get_inherit_false_spec.rb
+++ b/spec/rubocop/cop/gitlab/const_get_inherit_false_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/gitlab/const_get_inherit_false'
-RSpec.describe RuboCop::Cop::Gitlab::ConstGetInheritFalse, type: :rubocop do
+RSpec.describe RuboCop::Cop::Gitlab::ConstGetInheritFalse do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/gitlab/duplicate_spec_location_spec.rb b/spec/rubocop/cop/gitlab/duplicate_spec_location_spec.rb
index 1ed21e44290..5804b03b641 100644
--- a/spec/rubocop/cop/gitlab/duplicate_spec_location_spec.rb
+++ b/spec/rubocop/cop/gitlab/duplicate_spec_location_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require_relative '../../../../rubocop/cop/gitlab/duplicate_spec_location'
-RSpec.describe RuboCop::Cop::Gitlab::DuplicateSpecLocation, type: :rubocop do
+RSpec.describe RuboCop::Cop::Gitlab::DuplicateSpecLocation do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/gitlab/except_spec.rb b/spec/rubocop/cop/gitlab/except_spec.rb
index 50277d15a57..173e5943da5 100644
--- a/spec/rubocop/cop/gitlab/except_spec.rb
+++ b/spec/rubocop/cop/gitlab/except_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/gitlab/except'
-RSpec.describe RuboCop::Cop::Gitlab::Except, type: :rubocop do
+RSpec.describe RuboCop::Cop::Gitlab::Except do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/gitlab/finder_with_find_by_spec.rb b/spec/rubocop/cop/gitlab/finder_with_find_by_spec.rb
index a47625d5dc1..db3bcf1dfdb 100644
--- a/spec/rubocop/cop/gitlab/finder_with_find_by_spec.rb
+++ b/spec/rubocop/cop/gitlab/finder_with_find_by_spec.rb
@@ -7,7 +7,7 @@ require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/gitlab/finder_with_find_by'
-RSpec.describe RuboCop::Cop::Gitlab::FinderWithFindBy, type: :rubocop do
+RSpec.describe RuboCop::Cop::Gitlab::FinderWithFindBy do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/gitlab/httparty_spec.rb b/spec/rubocop/cop/gitlab/httparty_spec.rb
index 379365096ba..b112ac84bff 100644
--- a/spec/rubocop/cop/gitlab/httparty_spec.rb
+++ b/spec/rubocop/cop/gitlab/httparty_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/gitlab/httparty'
-RSpec.describe RuboCop::Cop::Gitlab::HTTParty, type: :rubocop do # rubocop:disable RSpec/FilePath
+RSpec.describe RuboCop::Cop::Gitlab::HTTParty do # rubocop:disable RSpec/FilePath
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/gitlab/intersect_spec.rb b/spec/rubocop/cop/gitlab/intersect_spec.rb
index 351033d0ed2..e724f47029c 100644
--- a/spec/rubocop/cop/gitlab/intersect_spec.rb
+++ b/spec/rubocop/cop/gitlab/intersect_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/gitlab/intersect'
-RSpec.describe RuboCop::Cop::Gitlab::Intersect, type: :rubocop do
+RSpec.describe RuboCop::Cop::Gitlab::Intersect do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/gitlab/json_spec.rb b/spec/rubocop/cop/gitlab/json_spec.rb
index 6f5ec07ffb1..fc25f69a244 100644
--- a/spec/rubocop/cop/gitlab/json_spec.rb
+++ b/spec/rubocop/cop/gitlab/json_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/gitlab/json'
-RSpec.describe RuboCop::Cop::Gitlab::Json, type: :rubocop do
+RSpec.describe RuboCop::Cop::Gitlab::Json do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/gitlab/module_with_instance_variables_spec.rb b/spec/rubocop/cop/gitlab/module_with_instance_variables_spec.rb
index 3d22201c92e..1d09c720bf7 100644
--- a/spec/rubocop/cop/gitlab/module_with_instance_variables_spec.rb
+++ b/spec/rubocop/cop/gitlab/module_with_instance_variables_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/gitlab/module_with_instance_variables'
-RSpec.describe RuboCop::Cop::Gitlab::ModuleWithInstanceVariables, type: :rubocop do
+RSpec.describe RuboCop::Cop::Gitlab::ModuleWithInstanceVariables do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/gitlab/policy_rule_boolean_spec.rb b/spec/rubocop/cop/gitlab/policy_rule_boolean_spec.rb
index 6221d038512..e6fb9ab9d57 100644
--- a/spec/rubocop/cop/gitlab/policy_rule_boolean_spec.rb
+++ b/spec/rubocop/cop/gitlab/policy_rule_boolean_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/gitlab/policy_rule_boolean'
-RSpec.describe RuboCop::Cop::Gitlab::PolicyRuleBoolean, type: :rubocop do
+RSpec.describe RuboCop::Cop::Gitlab::PolicyRuleBoolean do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/gitlab/predicate_memoization_spec.rb b/spec/rubocop/cop/gitlab/predicate_memoization_spec.rb
index ebe984b189d..322c7c82968 100644
--- a/spec/rubocop/cop/gitlab/predicate_memoization_spec.rb
+++ b/spec/rubocop/cop/gitlab/predicate_memoization_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/gitlab/predicate_memoization'
-RSpec.describe RuboCop::Cop::Gitlab::PredicateMemoization, type: :rubocop do
+RSpec.describe RuboCop::Cop::Gitlab::PredicateMemoization do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/gitlab/rails_logger_spec.rb b/spec/rubocop/cop/gitlab/rails_logger_spec.rb
index 70d208b31ec..768da243b02 100644
--- a/spec/rubocop/cop/gitlab/rails_logger_spec.rb
+++ b/spec/rubocop/cop/gitlab/rails_logger_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/gitlab/rails_logger'
-RSpec.describe RuboCop::Cop::Gitlab::RailsLogger, type: :rubocop do
+RSpec.describe RuboCop::Cop::Gitlab::RailsLogger do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/gitlab/union_spec.rb b/spec/rubocop/cop/gitlab/union_spec.rb
index 571dcc4eeb4..20364b1b901 100644
--- a/spec/rubocop/cop/gitlab/union_spec.rb
+++ b/spec/rubocop/cop/gitlab/union_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/gitlab/union'
-RSpec.describe RuboCop::Cop::Gitlab::Union, type: :rubocop do
+RSpec.describe RuboCop::Cop::Gitlab::Union do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/graphql/authorize_types_spec.rb b/spec/rubocop/cop/graphql/authorize_types_spec.rb
index df637a26ec5..a1b7a3f3a9b 100644
--- a/spec/rubocop/cop/graphql/authorize_types_spec.rb
+++ b/spec/rubocop/cop/graphql/authorize_types_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require_relative '../../../../rubocop/cop/graphql/authorize_types'
-RSpec.describe RuboCop::Cop::Graphql::AuthorizeTypes, type: :rubocop do
+RSpec.describe RuboCop::Cop::Graphql::AuthorizeTypes do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/graphql/descriptions_spec.rb b/spec/rubocop/cop/graphql/descriptions_spec.rb
index f4693057bcb..b44205b0920 100644
--- a/spec/rubocop/cop/graphql/descriptions_spec.rb
+++ b/spec/rubocop/cop/graphql/descriptions_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/graphql/descriptions'
-RSpec.describe RuboCop::Cop::Graphql::Descriptions, type: :rubocop do
+RSpec.describe RuboCop::Cop::Graphql::Descriptions do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/graphql/gid_expected_type_spec.rb b/spec/rubocop/cop/graphql/gid_expected_type_spec.rb
index a81af2aea5d..8fd7ae03748 100644
--- a/spec/rubocop/cop/graphql/gid_expected_type_spec.rb
+++ b/spec/rubocop/cop/graphql/gid_expected_type_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require_relative '../../../../rubocop/cop/graphql/gid_expected_type'
-RSpec.describe RuboCop::Cop::Graphql::GIDExpectedType, type: :rubocop do
+RSpec.describe RuboCop::Cop::Graphql::GIDExpectedType do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/graphql/id_type_spec.rb b/spec/rubocop/cop/graphql/id_type_spec.rb
index 8767412e282..6135c9fef43 100644
--- a/spec/rubocop/cop/graphql/id_type_spec.rb
+++ b/spec/rubocop/cop/graphql/id_type_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require_relative '../../../../rubocop/cop/graphql/id_type'
-RSpec.describe RuboCop::Cop::Graphql::IDType, type: :rubocop do
+RSpec.describe RuboCop::Cop::Graphql::IDType do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/graphql/json_type_spec.rb b/spec/rubocop/cop/graphql/json_type_spec.rb
index ac25e0feb69..6d9f86e44d2 100644
--- a/spec/rubocop/cop/graphql/json_type_spec.rb
+++ b/spec/rubocop/cop/graphql/json_type_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/graphql/json_type'
-RSpec.describe RuboCop::Cop::Graphql::JSONType, type: :rubocop do
+RSpec.describe RuboCop::Cop::Graphql::JSONType do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/graphql/resolver_type_spec.rb b/spec/rubocop/cop/graphql/resolver_type_spec.rb
index 4807d66396a..25213e30528 100644
--- a/spec/rubocop/cop/graphql/resolver_type_spec.rb
+++ b/spec/rubocop/cop/graphql/resolver_type_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require_relative '../../../../rubocop/cop/graphql/resolver_type'
-RSpec.describe RuboCop::Cop::Graphql::ResolverType, type: :rubocop do
+RSpec.describe RuboCop::Cop::Graphql::ResolverType do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/group_public_or_visible_to_user_spec.rb b/spec/rubocop/cop/group_public_or_visible_to_user_spec.rb
index 4e725deaafd..ac6c481a7c3 100644
--- a/spec/rubocop/cop/group_public_or_visible_to_user_spec.rb
+++ b/spec/rubocop/cop/group_public_or_visible_to_user_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../rubocop/cop/group_public_or_visible_to_user'
-RSpec.describe RuboCop::Cop::GroupPublicOrVisibleToUser, type: :rubocop do
+RSpec.describe RuboCop::Cop::GroupPublicOrVisibleToUser do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/ignored_columns_spec.rb b/spec/rubocop/cop/ignored_columns_spec.rb
index ec5499bbdff..38b4ac0bc1a 100644
--- a/spec/rubocop/cop/ignored_columns_spec.rb
+++ b/spec/rubocop/cop/ignored_columns_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../rubocop/cop/ignored_columns'
-RSpec.describe RuboCop::Cop::IgnoredColumns, type: :rubocop do
+RSpec.describe RuboCop::Cop::IgnoredColumns do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/include_sidekiq_worker_spec.rb b/spec/rubocop/cop/include_sidekiq_worker_spec.rb
index 33737babee5..f12652a1a58 100644
--- a/spec/rubocop/cop/include_sidekiq_worker_spec.rb
+++ b/spec/rubocop/cop/include_sidekiq_worker_spec.rb
@@ -7,7 +7,7 @@ require 'rubocop/rspec/support'
require_relative '../../../rubocop/cop/include_sidekiq_worker'
-RSpec.describe RuboCop::Cop::IncludeSidekiqWorker, type: :rubocop do
+RSpec.describe RuboCop::Cop::IncludeSidekiqWorker do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/inject_enterprise_edition_module_spec.rb b/spec/rubocop/cop/inject_enterprise_edition_module_spec.rb
index 767ed994542..47247006e42 100644
--- a/spec/rubocop/cop/inject_enterprise_edition_module_spec.rb
+++ b/spec/rubocop/cop/inject_enterprise_edition_module_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../rubocop/cop/inject_enterprise_edition_module'
-RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule, type: :rubocop do
+RSpec.describe RuboCop::Cop::InjectEnterpriseEditionModule do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/lint/last_keyword_argument_spec.rb b/spec/rubocop/cop/lint/last_keyword_argument_spec.rb
index 5822bf74e8d..33f80f7b799 100644
--- a/spec/rubocop/cop/lint/last_keyword_argument_spec.rb
+++ b/spec/rubocop/cop/lint/last_keyword_argument_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/lint/last_keyword_argument'
-RSpec.describe RuboCop::Cop::Lint::LastKeywordArgument, type: :rubocop do
+RSpec.describe RuboCop::Cop::Lint::LastKeywordArgument do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/add_column_with_default_spec.rb b/spec/rubocop/cop/migration/add_column_with_default_spec.rb
index 6deb092f235..cf476ae55d6 100644
--- a/spec/rubocop/cop/migration/add_column_with_default_spec.rb
+++ b/spec/rubocop/cop/migration/add_column_with_default_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/migration/add_column_with_default'
-RSpec.describe RuboCop::Cop::Migration::AddColumnWithDefault, type: :rubocop do
+RSpec.describe RuboCop::Cop::Migration::AddColumnWithDefault do
include CopHelper
let(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/add_columns_to_wide_tables_spec.rb b/spec/rubocop/cop/migration/add_columns_to_wide_tables_spec.rb
index 6ae4fb21126..92863c45b1a 100644
--- a/spec/rubocop/cop/migration/add_columns_to_wide_tables_spec.rb
+++ b/spec/rubocop/cop/migration/add_columns_to_wide_tables_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/migration/add_columns_to_wide_tables'
-RSpec.describe RuboCop::Cop::Migration::AddColumnsToWideTables, type: :rubocop do
+RSpec.describe RuboCop::Cop::Migration::AddColumnsToWideTables do
include CopHelper
let(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/add_concurrent_foreign_key_spec.rb b/spec/rubocop/cop/migration/add_concurrent_foreign_key_spec.rb
index aaf191a1b6b..25350ad1ecb 100644
--- a/spec/rubocop/cop/migration/add_concurrent_foreign_key_spec.rb
+++ b/spec/rubocop/cop/migration/add_concurrent_foreign_key_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/migration/add_concurrent_foreign_key'
-RSpec.describe RuboCop::Cop::Migration::AddConcurrentForeignKey, type: :rubocop do
+RSpec.describe RuboCop::Cop::Migration::AddConcurrentForeignKey do
include CopHelper
let(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/add_concurrent_index_spec.rb b/spec/rubocop/cop/migration/add_concurrent_index_spec.rb
index cef5295830c..351283a230a 100644
--- a/spec/rubocop/cop/migration/add_concurrent_index_spec.rb
+++ b/spec/rubocop/cop/migration/add_concurrent_index_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/migration/add_concurrent_index'
-RSpec.describe RuboCop::Cop::Migration::AddConcurrentIndex, type: :rubocop do
+RSpec.describe RuboCop::Cop::Migration::AddConcurrentIndex do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/add_index_spec.rb b/spec/rubocop/cop/migration/add_index_spec.rb
index 6bb78a7f3c7..1d083e9f2d2 100644
--- a/spec/rubocop/cop/migration/add_index_spec.rb
+++ b/spec/rubocop/cop/migration/add_index_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/migration/add_index'
-RSpec.describe RuboCop::Cop::Migration::AddIndex, type: :rubocop do
+RSpec.describe RuboCop::Cop::Migration::AddIndex do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/add_limit_to_text_columns_spec.rb b/spec/rubocop/cop/migration/add_limit_to_text_columns_spec.rb
index 0bea7bd7a0c..97b9d0d1ee2 100644
--- a/spec/rubocop/cop/migration/add_limit_to_text_columns_spec.rb
+++ b/spec/rubocop/cop/migration/add_limit_to_text_columns_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/migration/add_limit_to_text_columns'
-RSpec.describe RuboCop::Cop::Migration::AddLimitToTextColumns, type: :rubocop do
+RSpec.describe RuboCop::Cop::Migration::AddLimitToTextColumns do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/add_reference_spec.rb b/spec/rubocop/cop/migration/add_reference_spec.rb
index fab70d74b55..6e229d3eefc 100644
--- a/spec/rubocop/cop/migration/add_reference_spec.rb
+++ b/spec/rubocop/cop/migration/add_reference_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/migration/add_reference'
-RSpec.describe RuboCop::Cop::Migration::AddReference, type: :rubocop do
+RSpec.describe RuboCop::Cop::Migration::AddReference do
include CopHelper
let(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/add_timestamps_spec.rb b/spec/rubocop/cop/migration/add_timestamps_spec.rb
index c18b6b06ded..83570711ab9 100644
--- a/spec/rubocop/cop/migration/add_timestamps_spec.rb
+++ b/spec/rubocop/cop/migration/add_timestamps_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/migration/add_timestamps'
-RSpec.describe RuboCop::Cop::Migration::AddTimestamps, type: :rubocop do
+RSpec.describe RuboCop::Cop::Migration::AddTimestamps do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/complex_indexes_require_name_spec.rb b/spec/rubocop/cop/migration/complex_indexes_require_name_spec.rb
index b769109057e..38ccf546b7c 100644
--- a/spec/rubocop/cop/migration/complex_indexes_require_name_spec.rb
+++ b/spec/rubocop/cop/migration/complex_indexes_require_name_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/migration/complex_indexes_require_name'
-RSpec.describe RuboCop::Cop::Migration::ComplexIndexesRequireName, type: :rubocop do
+RSpec.describe RuboCop::Cop::Migration::ComplexIndexesRequireName do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/create_table_with_foreign_keys_spec.rb b/spec/rubocop/cop/migration/create_table_with_foreign_keys_spec.rb
index eaaa50b8190..2159bad1490 100644
--- a/spec/rubocop/cop/migration/create_table_with_foreign_keys_spec.rb
+++ b/spec/rubocop/cop/migration/create_table_with_foreign_keys_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/migration/create_table_with_foreign_keys'
-RSpec.describe RuboCop::Cop::Migration::CreateTableWithForeignKeys, type: :rubocop do
+RSpec.describe RuboCop::Cop::Migration::CreateTableWithForeignKeys do
include CopHelper
let(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/datetime_spec.rb b/spec/rubocop/cop/migration/datetime_spec.rb
index c5f6fd503ec..a3cccae21e0 100644
--- a/spec/rubocop/cop/migration/datetime_spec.rb
+++ b/spec/rubocop/cop/migration/datetime_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/migration/datetime'
-RSpec.describe RuboCop::Cop::Migration::Datetime, type: :rubocop do
+RSpec.describe RuboCop::Cop::Migration::Datetime do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/drop_table_spec.rb b/spec/rubocop/cop/migration/drop_table_spec.rb
index 9ce5ee45b08..d783cb56203 100644
--- a/spec/rubocop/cop/migration/drop_table_spec.rb
+++ b/spec/rubocop/cop/migration/drop_table_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/migration/drop_table'
-RSpec.describe RuboCop::Cop::Migration::DropTable, type: :rubocop do
+RSpec.describe RuboCop::Cop::Migration::DropTable do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/hash_index_spec.rb b/spec/rubocop/cop/migration/hash_index_spec.rb
index 3d26ea41d08..15f68eb990f 100644
--- a/spec/rubocop/cop/migration/hash_index_spec.rb
+++ b/spec/rubocop/cop/migration/hash_index_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/migration/hash_index'
-RSpec.describe RuboCop::Cop::Migration::HashIndex, type: :rubocop do
+RSpec.describe RuboCop::Cop::Migration::HashIndex do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/prevent_strings_spec.rb b/spec/rubocop/cop/migration/prevent_strings_spec.rb
index 6882dca1926..560a485017a 100644
--- a/spec/rubocop/cop/migration/prevent_strings_spec.rb
+++ b/spec/rubocop/cop/migration/prevent_strings_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/migration/prevent_strings'
-RSpec.describe RuboCop::Cop::Migration::PreventStrings, type: :rubocop do
+RSpec.describe RuboCop::Cop::Migration::PreventStrings do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/refer_to_index_by_name_spec.rb b/spec/rubocop/cop/migration/refer_to_index_by_name_spec.rb
index 76554d7446c..a25328a56a8 100644
--- a/spec/rubocop/cop/migration/refer_to_index_by_name_spec.rb
+++ b/spec/rubocop/cop/migration/refer_to_index_by_name_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/migration/refer_to_index_by_name'
-RSpec.describe RuboCop::Cop::Migration::ReferToIndexByName, type: :rubocop do
+RSpec.describe RuboCop::Cop::Migration::ReferToIndexByName do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/remove_column_spec.rb b/spec/rubocop/cop/migration/remove_column_spec.rb
index 7ef5556d8d7..4768093b10d 100644
--- a/spec/rubocop/cop/migration/remove_column_spec.rb
+++ b/spec/rubocop/cop/migration/remove_column_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/migration/remove_column'
-RSpec.describe RuboCop::Cop::Migration::RemoveColumn, type: :rubocop do
+RSpec.describe RuboCop::Cop::Migration::RemoveColumn do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/remove_concurrent_index_spec.rb b/spec/rubocop/cop/migration/remove_concurrent_index_spec.rb
index f70febb571d..8da368d588c 100644
--- a/spec/rubocop/cop/migration/remove_concurrent_index_spec.rb
+++ b/spec/rubocop/cop/migration/remove_concurrent_index_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/migration/remove_concurrent_index'
-RSpec.describe RuboCop::Cop::Migration::RemoveConcurrentIndex, type: :rubocop do
+RSpec.describe RuboCop::Cop::Migration::RemoveConcurrentIndex do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/remove_index_spec.rb b/spec/rubocop/cop/migration/remove_index_spec.rb
index cc82306a0f5..274c907ac41 100644
--- a/spec/rubocop/cop/migration/remove_index_spec.rb
+++ b/spec/rubocop/cop/migration/remove_index_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/migration/remove_index'
-RSpec.describe RuboCop::Cop::Migration::RemoveIndex, type: :rubocop do
+RSpec.describe RuboCop::Cop::Migration::RemoveIndex do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/safer_boolean_column_spec.rb b/spec/rubocop/cop/migration/safer_boolean_column_spec.rb
index 72b817fde12..aa7bb58ab45 100644
--- a/spec/rubocop/cop/migration/safer_boolean_column_spec.rb
+++ b/spec/rubocop/cop/migration/safer_boolean_column_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/migration/safer_boolean_column'
-RSpec.describe RuboCop::Cop::Migration::SaferBooleanColumn, type: :rubocop do
+RSpec.describe RuboCop::Cop::Migration::SaferBooleanColumn do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/timestamps_spec.rb b/spec/rubocop/cop/migration/timestamps_spec.rb
index 14b3cb36cf8..2f4154907d2 100644
--- a/spec/rubocop/cop/migration/timestamps_spec.rb
+++ b/spec/rubocop/cop/migration/timestamps_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/migration/timestamps'
-RSpec.describe RuboCop::Cop::Migration::Timestamps, type: :rubocop do
+RSpec.describe RuboCop::Cop::Migration::Timestamps do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/update_column_in_batches_spec.rb b/spec/rubocop/cop/migration/update_column_in_batches_spec.rb
index 1d50d8c675e..8049cba12d0 100644
--- a/spec/rubocop/cop/migration/update_column_in_batches_spec.rb
+++ b/spec/rubocop/cop/migration/update_column_in_batches_spec.rb
@@ -7,7 +7,7 @@ require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/migration/update_column_in_batches'
-RSpec.describe RuboCop::Cop::Migration::UpdateColumnInBatches, type: :rubocop do
+RSpec.describe RuboCop::Cop::Migration::UpdateColumnInBatches do
let(:cop) { described_class.new }
let(:tmp_rails_root) { rails_root_join('tmp', 'rails_root') }
let(:migration_code) do
diff --git a/spec/rubocop/cop/migration/with_lock_retries_disallowed_method_spec.rb b/spec/rubocop/cop/migration/with_lock_retries_disallowed_method_spec.rb
index 607daf0c9f0..814d87ea24b 100644
--- a/spec/rubocop/cop/migration/with_lock_retries_disallowed_method_spec.rb
+++ b/spec/rubocop/cop/migration/with_lock_retries_disallowed_method_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/migration/with_lock_retries_disallowed_method'
-RSpec.describe RuboCop::Cop::Migration::WithLockRetriesDisallowedMethod, type: :rubocop do
+RSpec.describe RuboCop::Cop::Migration::WithLockRetriesDisallowedMethod do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/migration/with_lock_retries_with_change_spec.rb b/spec/rubocop/cop/migration/with_lock_retries_with_change_spec.rb
index 93b96f3a20e..f0be14c8ee9 100644
--- a/spec/rubocop/cop/migration/with_lock_retries_with_change_spec.rb
+++ b/spec/rubocop/cop/migration/with_lock_retries_with_change_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/migration/with_lock_retries_with_change'
-RSpec.describe RuboCop::Cop::Migration::WithLockRetriesWithChange, type: :rubocop do
+RSpec.describe RuboCop::Cop::Migration::WithLockRetriesWithChange do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/performance/ar_count_each_spec.rb b/spec/rubocop/cop/performance/ar_count_each_spec.rb
index 33b667dd52f..6242c7a4c5e 100644
--- a/spec/rubocop/cop/performance/ar_count_each_spec.rb
+++ b/spec/rubocop/cop/performance/ar_count_each_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/performance/ar_count_each.rb'
-RSpec.describe RuboCop::Cop::Performance::ARCountEach, type: :rubocop do
+RSpec.describe RuboCop::Cop::Performance::ARCountEach do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/performance/ar_exists_and_present_blank_spec.rb b/spec/rubocop/cop/performance/ar_exists_and_present_blank_spec.rb
index 972f3c52153..3321d400ae1 100644
--- a/spec/rubocop/cop/performance/ar_exists_and_present_blank_spec.rb
+++ b/spec/rubocop/cop/performance/ar_exists_and_present_blank_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/performance/ar_exists_and_present_blank.rb'
-RSpec.describe RuboCop::Cop::Performance::ARExistsAndPresentBlank, type: :rubocop do
+RSpec.describe RuboCop::Cop::Performance::ARExistsAndPresentBlank do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/performance/readlines_each_spec.rb b/spec/rubocop/cop/performance/readlines_each_spec.rb
index 2f222f1dc00..c19426606f6 100644
--- a/spec/rubocop/cop/performance/readlines_each_spec.rb
+++ b/spec/rubocop/cop/performance/readlines_each_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/performance/readlines_each'
-RSpec.describe RuboCop::Cop::Performance::ReadlinesEach, type: :rubocop do
+RSpec.describe RuboCop::Cop::Performance::ReadlinesEach do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/prefer_class_methods_over_module_spec.rb b/spec/rubocop/cop/prefer_class_methods_over_module_spec.rb
index bed8d331209..dc665f9dd25 100644
--- a/spec/rubocop/cop/prefer_class_methods_over_module_spec.rb
+++ b/spec/rubocop/cop/prefer_class_methods_over_module_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../rubocop/cop/prefer_class_methods_over_module'
-RSpec.describe RuboCop::Cop::PreferClassMethodsOverModule, type: :rubocop do
+RSpec.describe RuboCop::Cop::PreferClassMethodsOverModule do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/project_path_helper_spec.rb b/spec/rubocop/cop/project_path_helper_spec.rb
index 0e5b0b10ae6..78a590b89f6 100644
--- a/spec/rubocop/cop/project_path_helper_spec.rb
+++ b/spec/rubocop/cop/project_path_helper_spec.rb
@@ -7,7 +7,7 @@ require 'rubocop/rspec/support'
require_relative '../../../rubocop/cop/project_path_helper'
-RSpec.describe RuboCop::Cop::ProjectPathHelper, type: :rubocop do
+RSpec.describe RuboCop::Cop::ProjectPathHelper do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/put_group_routes_under_scope_spec.rb b/spec/rubocop/cop/put_group_routes_under_scope_spec.rb
index 888d1b6a2ba..46b50d7690b 100644
--- a/spec/rubocop/cop/put_group_routes_under_scope_spec.rb
+++ b/spec/rubocop/cop/put_group_routes_under_scope_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../rubocop/cop/put_group_routes_under_scope'
-RSpec.describe RuboCop::Cop::PutGroupRoutesUnderScope, type: :rubocop do
+RSpec.describe RuboCop::Cop::PutGroupRoutesUnderScope do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/put_project_routes_under_scope_spec.rb b/spec/rubocop/cop/put_project_routes_under_scope_spec.rb
index eebb7f3eb61..b0627af0e8b 100644
--- a/spec/rubocop/cop/put_project_routes_under_scope_spec.rb
+++ b/spec/rubocop/cop/put_project_routes_under_scope_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../rubocop/cop/put_project_routes_under_scope'
-RSpec.describe RuboCop::Cop::PutProjectRoutesUnderScope, type: :rubocop do
+RSpec.describe RuboCop::Cop::PutProjectRoutesUnderScope do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/qa/ambiguous_page_object_name_spec.rb b/spec/rubocop/cop/qa/ambiguous_page_object_name_spec.rb
index 484b5fad473..4876fcd5050 100644
--- a/spec/rubocop/cop/qa/ambiguous_page_object_name_spec.rb
+++ b/spec/rubocop/cop/qa/ambiguous_page_object_name_spec.rb
@@ -7,7 +7,7 @@ require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/qa/ambiguous_page_object_name'
-RSpec.describe RuboCop::Cop::QA::AmbiguousPageObjectName, type: :rubocop do
+RSpec.describe RuboCop::Cop::QA::AmbiguousPageObjectName do
include CopHelper
let(:source_file) { 'qa/page.rb' }
diff --git a/spec/rubocop/cop/qa/element_with_pattern_spec.rb b/spec/rubocop/cop/qa/element_with_pattern_spec.rb
index 0e599701531..6289b1a7c97 100644
--- a/spec/rubocop/cop/qa/element_with_pattern_spec.rb
+++ b/spec/rubocop/cop/qa/element_with_pattern_spec.rb
@@ -7,7 +7,7 @@ require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/qa/element_with_pattern'
-RSpec.describe RuboCop::Cop::QA::ElementWithPattern, type: :rubocop do
+RSpec.describe RuboCop::Cop::QA::ElementWithPattern do
include CopHelper
let(:source_file) { 'qa/page.rb' }
diff --git a/spec/rubocop/cop/rspec/any_instance_of_spec.rb b/spec/rubocop/cop/rspec/any_instance_of_spec.rb
index 971e28853a3..42bb7d196a1 100644
--- a/spec/rubocop/cop/rspec/any_instance_of_spec.rb
+++ b/spec/rubocop/cop/rspec/any_instance_of_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require_relative '../../../../rubocop/cop/rspec/any_instance_of'
-RSpec.describe RuboCop::Cop::RSpec::AnyInstanceOf, type: :rubocop do
+RSpec.describe RuboCop::Cop::RSpec::AnyInstanceOf do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/rspec/be_success_matcher_spec.rb b/spec/rubocop/cop/rspec/be_success_matcher_spec.rb
index b14cf39cbde..d49507c89b1 100644
--- a/spec/rubocop/cop/rspec/be_success_matcher_spec.rb
+++ b/spec/rubocop/cop/rspec/be_success_matcher_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/rspec/be_success_matcher'
-RSpec.describe RuboCop::Cop::RSpec::BeSuccessMatcher, type: :rubocop do
+RSpec.describe RuboCop::Cop::RSpec::BeSuccessMatcher do
include CopHelper
let(:source_file) { 'spec/foo_spec.rb' }
diff --git a/spec/rubocop/cop/rspec/env_assignment_spec.rb b/spec/rubocop/cop/rspec/env_assignment_spec.rb
index 72ad584dd6f..07afd30fc90 100644
--- a/spec/rubocop/cop/rspec/env_assignment_spec.rb
+++ b/spec/rubocop/cop/rspec/env_assignment_spec.rb
@@ -7,7 +7,7 @@ require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/rspec/env_assignment'
-RSpec.describe RuboCop::Cop::RSpec::EnvAssignment, type: :rubocop do
+RSpec.describe RuboCop::Cop::RSpec::EnvAssignment do
include CopHelper
offense_call_single_quotes_key = %(ENV['FOO'] = 'bar').freeze
diff --git a/spec/rubocop/cop/rspec/factories_in_migration_specs_spec.rb b/spec/rubocop/cop/rspec/factories_in_migration_specs_spec.rb
index 1bb93402a5b..fe9cea47a43 100644
--- a/spec/rubocop/cop/rspec/factories_in_migration_specs_spec.rb
+++ b/spec/rubocop/cop/rspec/factories_in_migration_specs_spec.rb
@@ -7,7 +7,7 @@ require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/rspec/factories_in_migration_specs'
-RSpec.describe RuboCop::Cop::RSpec::FactoriesInMigrationSpecs, type: :rubocop do
+RSpec.describe RuboCop::Cop::RSpec::FactoriesInMigrationSpecs do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/rspec/factory_bot/inline_association_spec.rb b/spec/rubocop/cop/rspec/factory_bot/inline_association_spec.rb
index 70dbe086127..33fdaaee3c7 100644
--- a/spec/rubocop/cop/rspec/factory_bot/inline_association_spec.rb
+++ b/spec/rubocop/cop/rspec/factory_bot/inline_association_spec.rb
@@ -6,7 +6,7 @@ require 'rubocop'
require_relative '../../../../../rubocop/cop/rspec/factory_bot/inline_association'
-RSpec.describe RuboCop::Cop::RSpec::FactoryBot::InlineAssociation, type: :rubocop do
+RSpec.describe RuboCop::Cop::RSpec::FactoryBot::InlineAssociation do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/rspec/htt_party_basic_auth_spec.rb b/spec/rubocop/cop/rspec/htt_party_basic_auth_spec.rb
index 8c3703a488a..6e9e436602c 100644
--- a/spec/rubocop/cop/rspec/htt_party_basic_auth_spec.rb
+++ b/spec/rubocop/cop/rspec/htt_party_basic_auth_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require_relative '../../../../rubocop/cop/rspec/httparty_basic_auth'
-RSpec.describe RuboCop::Cop::RSpec::HTTPartyBasicAuth, type: :rubocop do
+RSpec.describe RuboCop::Cop::RSpec::HTTPartyBasicAuth do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/rspec/modify_sidekiq_middleware_spec.rb b/spec/rubocop/cop/rspec/modify_sidekiq_middleware_spec.rb
index ca47bba4264..d9e3ca5741c 100644
--- a/spec/rubocop/cop/rspec/modify_sidekiq_middleware_spec.rb
+++ b/spec/rubocop/cop/rspec/modify_sidekiq_middleware_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/rspec/modify_sidekiq_middleware'
-RSpec.describe RuboCop::Cop::RSpec::ModifySidekiqMiddleware, type: :rubocop do
+RSpec.describe RuboCop::Cop::RSpec::ModifySidekiqMiddleware do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/rspec/timecop_freeze_spec.rb b/spec/rubocop/cop/rspec/timecop_freeze_spec.rb
index 3809431a2fc..b1cf82492e4 100644
--- a/spec/rubocop/cop/rspec/timecop_freeze_spec.rb
+++ b/spec/rubocop/cop/rspec/timecop_freeze_spec.rb
@@ -7,7 +7,7 @@ require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/rspec/timecop_freeze'
-RSpec.describe RuboCop::Cop::RSpec::TimecopFreeze, type: :rubocop do
+RSpec.describe RuboCop::Cop::RSpec::TimecopFreeze do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/rspec/timecop_travel_spec.rb b/spec/rubocop/cop/rspec/timecop_travel_spec.rb
index 25a8127d40e..2ee8bfe9ad7 100644
--- a/spec/rubocop/cop/rspec/timecop_travel_spec.rb
+++ b/spec/rubocop/cop/rspec/timecop_travel_spec.rb
@@ -7,7 +7,7 @@ require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/rspec/timecop_travel'
-RSpec.describe RuboCop::Cop::RSpec::TimecopTravel, type: :rubocop do
+RSpec.describe RuboCop::Cop::RSpec::TimecopTravel do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/rspec/top_level_describe_path_spec.rb b/spec/rubocop/cop/rspec/top_level_describe_path_spec.rb
index 92a76bde243..4936936836d 100644
--- a/spec/rubocop/cop/rspec/top_level_describe_path_spec.rb
+++ b/spec/rubocop/cop/rspec/top_level_describe_path_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/rspec/top_level_describe_path'
-RSpec.describe RuboCop::Cop::RSpec::TopLevelDescribePath, type: :rubocop do
+RSpec.describe RuboCop::Cop::RSpec::TopLevelDescribePath do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/ruby_interpolation_in_translation_spec.rb b/spec/rubocop/cop/ruby_interpolation_in_translation_spec.rb
index 938ddc7fb6a..a6a44b3fa68 100644
--- a/spec/rubocop/cop/ruby_interpolation_in_translation_spec.rb
+++ b/spec/rubocop/cop/ruby_interpolation_in_translation_spec.rb
@@ -9,7 +9,7 @@ require_relative '../../../rubocop/cop/ruby_interpolation_in_translation'
# Disabling interpolation check as we deliberately want to have #{} in strings.
# rubocop:disable Lint/InterpolationCheck
-RSpec.describe RuboCop::Cop::RubyInterpolationInTranslation, type: :rubocop do
+RSpec.describe RuboCop::Cop::RubyInterpolationInTranslation do
subject(:cop) { described_class.new }
it 'does not add an offence for a regular messages' do
diff --git a/spec/rubocop/cop/safe_params_spec.rb b/spec/rubocop/cop/safe_params_spec.rb
index c4f683a41bf..c8f6768c4bb 100644
--- a/spec/rubocop/cop/safe_params_spec.rb
+++ b/spec/rubocop/cop/safe_params_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../rubocop/cop/safe_params'
-RSpec.describe RuboCop::Cop::SafeParams, type: :rubocop do
+RSpec.describe RuboCop::Cop::SafeParams do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/scalability/bulk_perform_with_context_spec.rb b/spec/rubocop/cop/scalability/bulk_perform_with_context_spec.rb
index 48964ab76e0..6e526f7ad8f 100644
--- a/spec/rubocop/cop/scalability/bulk_perform_with_context_spec.rb
+++ b/spec/rubocop/cop/scalability/bulk_perform_with_context_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/scalability/bulk_perform_with_context'
-RSpec.describe RuboCop::Cop::Scalability::BulkPerformWithContext, type: :rubocop do
+RSpec.describe RuboCop::Cop::Scalability::BulkPerformWithContext do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/scalability/cron_worker_context_spec.rb b/spec/rubocop/cop/scalability/cron_worker_context_spec.rb
index 4b4ee7258f1..4699e06e9cf 100644
--- a/spec/rubocop/cop/scalability/cron_worker_context_spec.rb
+++ b/spec/rubocop/cop/scalability/cron_worker_context_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/scalability/cron_worker_context'
-RSpec.describe RuboCop::Cop::Scalability::CronWorkerContext, type: :rubocop do
+RSpec.describe RuboCop::Cop::Scalability::CronWorkerContext do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/scalability/file_uploads_spec.rb b/spec/rubocop/cop/scalability/file_uploads_spec.rb
index ed826728681..78ff7fea55c 100644
--- a/spec/rubocop/cop/scalability/file_uploads_spec.rb
+++ b/spec/rubocop/cop/scalability/file_uploads_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/scalability/file_uploads'
-RSpec.describe RuboCop::Cop::Scalability::FileUploads, type: :rubocop do
+RSpec.describe RuboCop::Cop::Scalability::FileUploads do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/scalability/idempotent_worker_spec.rb b/spec/rubocop/cop/scalability/idempotent_worker_spec.rb
index 9197cc954f5..666122a9de4 100644
--- a/spec/rubocop/cop/scalability/idempotent_worker_spec.rb
+++ b/spec/rubocop/cop/scalability/idempotent_worker_spec.rb
@@ -4,7 +4,7 @@ require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/scalability/idempotent_worker'
-RSpec.describe RuboCop::Cop::Scalability::IdempotentWorker, type: :rubocop do
+RSpec.describe RuboCop::Cop::Scalability::IdempotentWorker do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/sidekiq_options_queue_spec.rb b/spec/rubocop/cop/sidekiq_options_queue_spec.rb
index e76265d426c..306cbcf62b5 100644
--- a/spec/rubocop/cop/sidekiq_options_queue_spec.rb
+++ b/spec/rubocop/cop/sidekiq_options_queue_spec.rb
@@ -7,7 +7,7 @@ require 'rubocop/rspec/support'
require_relative '../../../rubocop/cop/sidekiq_options_queue'
-RSpec.describe RuboCop::Cop::SidekiqOptionsQueue, type: :rubocop do
+RSpec.describe RuboCop::Cop::SidekiqOptionsQueue do
include CopHelper
subject(:cop) { described_class.new }
diff --git a/spec/rubocop/cop/static_translation_definition_spec.rb b/spec/rubocop/cop/static_translation_definition_spec.rb
index f3185def3d7..8a38a318999 100644
--- a/spec/rubocop/cop/static_translation_definition_spec.rb
+++ b/spec/rubocop/cop/static_translation_definition_spec.rb
@@ -7,7 +7,7 @@ require 'rspec-parameterized'
require_relative '../../../rubocop/cop/static_translation_definition'
-RSpec.describe RuboCop::Cop::StaticTranslationDefinition, type: :rubocop do
+RSpec.describe RuboCop::Cop::StaticTranslationDefinition do
include CopHelper
using RSpec::Parameterized::TableSyntax
diff --git a/spec/rubocop/cop/usage_data/distinct_count_by_large_foreign_key_spec.rb b/spec/rubocop/cop/usage_data/distinct_count_by_large_foreign_key_spec.rb
index 8b6a2eac349..1c90df798a5 100644
--- a/spec/rubocop/cop/usage_data/distinct_count_by_large_foreign_key_spec.rb
+++ b/spec/rubocop/cop/usage_data/distinct_count_by_large_foreign_key_spec.rb
@@ -7,7 +7,7 @@ require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/usage_data/distinct_count_by_large_foreign_key'
-RSpec.describe RuboCop::Cop::UsageData::DistinctCountByLargeForeignKey, type: :rubocop do
+RSpec.describe RuboCop::Cop::UsageData::DistinctCountByLargeForeignKey do
include CopHelper
let(:allowed_foreign_keys) { [:author_id, :user_id, :'merge_requests.target_project_id'] }
diff --git a/spec/rubocop/cop/usage_data/large_table_spec.rb b/spec/rubocop/cop/usage_data/large_table_spec.rb
index de6fb9c17e2..638e8c67dc8 100644
--- a/spec/rubocop/cop/usage_data/large_table_spec.rb
+++ b/spec/rubocop/cop/usage_data/large_table_spec.rb
@@ -7,7 +7,7 @@ require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/usage_data/large_table'
-RSpec.describe RuboCop::Cop::UsageData::LargeTable, type: :rubocop do
+RSpec.describe RuboCop::Cop::UsageData::LargeTable do
include CopHelper
let(:large_tables) { %i[Rails Time] }
diff --git a/spec/rubocop/qa_helpers_spec.rb b/spec/rubocop/qa_helpers_spec.rb
index 786b9c78952..051817903a8 100644
--- a/spec/rubocop/qa_helpers_spec.rb
+++ b/spec/rubocop/qa_helpers_spec.rb
@@ -5,7 +5,7 @@ require 'rubocop'
require 'parser/current'
require_relative '../../rubocop/qa_helpers'
-RSpec.describe RuboCop::QAHelpers, type: :rubocop do
+RSpec.describe RuboCop::QAHelpers do
def parse_source(source, path = 'foo.rb')
buffer = Parser::Source::Buffer.new(path)
buffer.source = source
diff --git a/spec/services/merge_requests/after_create_service_spec.rb b/spec/services/merge_requests/after_create_service_spec.rb
index 69bab3b1ea4..bdc064a6269 100644
--- a/spec/services/merge_requests/after_create_service_spec.rb
+++ b/spec/services/merge_requests/after_create_service_spec.rb
@@ -27,6 +27,14 @@ RSpec.describe MergeRequests::AfterCreateService do
execute_service
end
+ it 'calls the merge request activity counter' do
+ expect(Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter)
+ .to receive(:track_create_mr_action)
+ .with(user: merge_request.author)
+
+ execute_service
+ end
+
it 'creates a new merge request notification' do
expect(notification_service)
.to receive(:new_merge_request).with(merge_request, merge_request.author)
diff --git a/spec/services/merge_requests/close_service_spec.rb b/spec/services/merge_requests/close_service_spec.rb
index 67fb4eaade5..ca3225cab2c 100644
--- a/spec/services/merge_requests/close_service_spec.rb
+++ b/spec/services/merge_requests/close_service_spec.rb
@@ -75,6 +75,14 @@ RSpec.describe MergeRequests::CloseService do
described_class.new(project, user, {}).execute(merge_request)
end
+ it 'calls the merge request activity counter' do
+ expect(Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter)
+ .to receive(:track_close_mr_action)
+ .with(user: user)
+
+ described_class.new(project, user, {}).execute(merge_request)
+ end
+
it 'refreshes the number of open merge requests for a valid MR', :use_clean_rails_memory_store_caching do
service = described_class.new(project, user, {})
diff --git a/spec/services/merge_requests/merge_service_spec.rb b/spec/services/merge_requests/merge_service_spec.rb
index d0e3102f157..4e1d8b3a9a9 100644
--- a/spec/services/merge_requests/merge_service_spec.rb
+++ b/spec/services/merge_requests/merge_service_spec.rb
@@ -19,8 +19,12 @@ RSpec.describe MergeRequests::MergeService do
{ commit_message: 'Awesome message', sha: merge_request.diff_head_sha }
end
+ let(:feature_flag_persist_squash) { true }
+
context 'valid params' do
before do
+ stub_feature_flags(persist_squash_commit_sha_for_squashes: feature_flag_persist_squash)
+
allow(service).to receive(:execute_hooks)
expect(merge_request).to receive(:update_and_mark_in_progress_merge_commit_sha).twice.and_call_original
@@ -37,6 +41,10 @@ RSpec.describe MergeRequests::MergeService do
expect(merge_request.in_progress_merge_commit_sha).to be_nil
end
+ it 'does not update squash_commit_sha if it is not a squash' do
+ expect(merge_request.squash_commit_sha).to be_nil
+ end
+
it 'sends email to user2 about merge of new merge_request' do
email = ActionMailer::Base.deliveries.last
expect(email.to.first).to eq(user2.email)
@@ -76,6 +84,20 @@ RSpec.describe MergeRequests::MergeService do
expect(merge_commit.message).to eq('Merge commit message')
expect(squash_commit.message).to eq("Squash commit message\n")
end
+
+ it 'persists squash_commit_sha' do
+ squash_commit = merge_request.merge_commit.parents.last
+
+ expect(merge_request.squash_commit_sha).to eq(squash_commit.id)
+ end
+
+ context 'when feature flag is disabled' do
+ let(:feature_flag_persist_squash) { false }
+
+ it 'does not populate squash_commit_sha' do
+ expect(merge_request.squash_commit_sha).to be_nil
+ end
+ end
end
end
@@ -361,6 +383,7 @@ RSpec.describe MergeRequests::MergeService do
expect(merge_request).to be_open
expect(merge_request.merge_commit_sha).to be_nil
+ expect(merge_request.squash_commit_sha).to be_nil
expect(merge_request.merge_error).to include(error_message)
expect(Gitlab::AppLogger).to have_received(:error).with(a_string_matching(error_message))
end
@@ -381,6 +404,7 @@ RSpec.describe MergeRequests::MergeService do
expect(merge_request).to be_open
expect(merge_request.merge_commit_sha).to be_nil
+ expect(merge_request.squash_commit_sha).to be_nil
expect(merge_request.merge_error).to include(error_message)
expect(Gitlab::AppLogger).to have_received(:error).with(a_string_matching(error_message))
end
@@ -395,10 +419,27 @@ RSpec.describe MergeRequests::MergeService do
expect(merge_request).to be_open
expect(merge_request.merge_commit_sha).to be_nil
+ expect(merge_request.squash_commit_sha).to be_nil
expect(merge_request.merge_error).to include(error_message)
expect(Gitlab::AppLogger).to have_received(:error).with(a_string_matching(error_message))
end
+ it 'logs and saves error if there is an PreReceiveError exception' do
+ error_message = 'error message'
+
+ allow(service).to receive(:repository).and_raise(Gitlab::Git::PreReceiveError, "GitLab: #{error_message}")
+ allow(service).to receive(:execute_hooks)
+ merge_request.update!(squash: true)
+
+ service.execute(merge_request)
+
+ expect(merge_request).to be_open
+ expect(merge_request.merge_commit_sha).to be_nil
+ expect(merge_request.squash_commit_sha).to be_nil
+ expect(merge_request.merge_error).to include('Something went wrong during merge pre-receive hook')
+ expect(Gitlab::AppLogger).to have_received(:error).with(a_string_matching(error_message))
+ end
+
context 'when fast-forward merge is not allowed' do
before do
allow_any_instance_of(Repository).to receive(:ancestor?).and_return(nil)
@@ -415,6 +456,7 @@ RSpec.describe MergeRequests::MergeService do
expect(merge_request).to be_open
expect(merge_request.merge_commit_sha).to be_nil
+ expect(merge_request.squash_commit_sha).to be_nil
expect(merge_request.merge_error).to include(error_message)
expect(Gitlab::AppLogger).to have_received(:error).with(a_string_matching(error_message))
end
diff --git a/spec/services/merge_requests/post_merge_service_spec.rb b/spec/services/merge_requests/post_merge_service_spec.rb
index 402f753c0af..d7dba691da9 100644
--- a/spec/services/merge_requests/post_merge_service_spec.rb
+++ b/spec/services/merge_requests/post_merge_service_spec.rb
@@ -37,6 +37,14 @@ RSpec.describe MergeRequests::PostMergeService do
subject
end
+ it 'calls the merge request activity counter' do
+ expect(Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter)
+ .to receive(:track_merge_mr_action)
+ .with(user: user)
+
+ subject
+ end
+
it 'deletes non-latest diffs' do
diff_removal_service = instance_double(MergeRequests::DeleteNonLatestDiffsService, execute: nil)
diff --git a/spec/services/merge_requests/reopen_service_spec.rb b/spec/services/merge_requests/reopen_service_spec.rb
index 2bd83dc36a8..9879e940747 100644
--- a/spec/services/merge_requests/reopen_service_spec.rb
+++ b/spec/services/merge_requests/reopen_service_spec.rb
@@ -80,6 +80,14 @@ RSpec.describe MergeRequests::ReopenService do
described_class.new(project, user, {}).execute(merge_request)
end
+ it 'calls the merge request activity counter' do
+ expect(Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter)
+ .to receive(:track_reopen_mr_action)
+ .with(user: user)
+
+ described_class.new(project, user, {}).execute(merge_request)
+ end
+
it 'refreshes the number of open merge requests for a valid MR' do
service = described_class.new(project, user, {})
diff --git a/spec/support/rspec.rb b/spec/support/rspec.rb
index 32f738faa9b..00b9aac7bf4 100644
--- a/spec/support/rspec.rb
+++ b/spec/support/rspec.rb
@@ -25,4 +25,8 @@ RSpec.configure do |config|
config.include FastRailsRoot
config.include RuboCop::RSpec::ExpectOffense, type: :rubocop
+
+ config.define_derived_metadata(file_path: %r{spec/rubocop}) do |metadata|
+ metadata[:type] = :rubocop
+ end
end
diff --git a/workhorse/CHANGELOG b/workhorse/CHANGELOG
index 489ac4531fc..271928845c1 100644
--- a/workhorse/CHANGELOG
+++ b/workhorse/CHANGELOG
@@ -1,5 +1,17 @@
# Changelog for gitlab-workhorse
+## v8.58.2
+
+### Security
+- Allow DELETE HTTP method
+ https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/
+
+## v8.58.1
+
+### Security
+- Reject unknown http methods
+ https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/
+
## v8.58.0
### Added
diff --git a/workhorse/VERSION b/workhorse/VERSION
index b315ff1896d..8aa8b5f68bd 100644
--- a/workhorse/VERSION
+++ b/workhorse/VERSION
@@ -1 +1 @@
-8.58.0
+8.58.2
diff --git a/workhorse/internal/rejectmethods/middleware.go b/workhorse/internal/rejectmethods/middleware.go
new file mode 100644
index 00000000000..171463979d5
--- /dev/null
+++ b/workhorse/internal/rejectmethods/middleware.go
@@ -0,0 +1,38 @@
+package rejectmethods
+
+import (
+ "net/http"
+
+ "github.com/prometheus/client_golang/prometheus"
+)
+
+var acceptedMethods = map[string]bool{
+ http.MethodGet: true,
+ http.MethodHead: true,
+ http.MethodPost: true,
+ http.MethodPut: true,
+ http.MethodPatch: true,
+ http.MethodDelete: true,
+ http.MethodConnect: true,
+ http.MethodOptions: true,
+ http.MethodTrace: true,
+}
+
+var rejectedRequestsCount = prometheus.NewCounter(
+ prometheus.CounterOpts{
+ Name: "gitlab_workhorse_unknown_method_rejected_requests",
+ Help: "The number of requests with unknown HTTP method which were rejected",
+ },
+)
+
+// NewMiddleware returns middleware which rejects all unknown http methods
+func NewMiddleware(handler http.Handler) http.Handler {
+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if acceptedMethods[r.Method] {
+ handler.ServeHTTP(w, r)
+ } else {
+ rejectedRequestsCount.Inc()
+ http.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)
+ }
+ })
+}
diff --git a/workhorse/internal/rejectmethods/middleware_test.go b/workhorse/internal/rejectmethods/middleware_test.go
new file mode 100644
index 00000000000..2921975aeef
--- /dev/null
+++ b/workhorse/internal/rejectmethods/middleware_test.go
@@ -0,0 +1,43 @@
+package rejectmethods
+
+import (
+ "io"
+ "net/http"
+ "net/http/httptest"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+)
+
+func TestNewMiddleware(t *testing.T) {
+ handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ io.WriteString(w, "OK\n")
+ })
+
+ middleware := NewMiddleware(handler)
+
+ acceptedMethods := []string{"GET", "HEAD", "POST", "PUT", "PATCH", "CONNECT", "OPTIONS", "TRACE"}
+ for _, method := range acceptedMethods {
+ t.Run(method, func(t *testing.T) {
+ tmpRequest, _ := http.NewRequest(method, "/", nil)
+ recorder := httptest.NewRecorder()
+
+ middleware.ServeHTTP(recorder, tmpRequest)
+
+ result := recorder.Result()
+
+ require.Equal(t, http.StatusOK, result.StatusCode)
+ })
+ }
+
+ t.Run("UNKNOWN", func(t *testing.T) {
+ tmpRequest, _ := http.NewRequest("UNKNOWN", "/", nil)
+ recorder := httptest.NewRecorder()
+
+ middleware.ServeHTTP(recorder, tmpRequest)
+
+ result := recorder.Result()
+
+ require.Equal(t, http.StatusMethodNotAllowed, result.StatusCode)
+ })
+}
diff --git a/workhorse/internal/upstream/upstream.go b/workhorse/internal/upstream/upstream.go
index fd3f6191a5a..c81a21c0ecd 100644
--- a/workhorse/internal/upstream/upstream.go
+++ b/workhorse/internal/upstream/upstream.go
@@ -17,6 +17,7 @@ import (
"gitlab.com/gitlab-org/gitlab-workhorse/internal/config"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
+ "gitlab.com/gitlab-org/gitlab-workhorse/internal/rejectmethods"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/upload"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/upstream/roundtripper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/urlprefix"
@@ -63,6 +64,8 @@ func NewUpstream(cfg config.Config, accessLogger *logrus.Logger) http.Handler {
}
handler := correlation.InjectCorrelationID(&up, correlationOpts...)
+ // TODO: move to LabKit https://gitlab.com/gitlab-org/gitlab-workhorse/-/issues/339
+ handler = rejectmethods.NewMiddleware(handler)
return handler
}
diff --git a/workhorse/main_test.go b/workhorse/main_test.go
index 16fa8ff10b7..d15af1d3e4c 100644
--- a/workhorse/main_test.go
+++ b/workhorse/main_test.go
@@ -642,6 +642,24 @@ func TestPropagateCorrelationIdHeader(t *testing.T) {
}
}
+func TestRejectUnknownMethod(t *testing.T) {
+ ts := testhelper.TestServerWithHandler(regexp.MustCompile(`.`), func(w http.ResponseWriter, r *http.Request) {
+ w.WriteHeader(200)
+ })
+ defer ts.Close()
+ ws := startWorkhorseServer(ts.URL)
+ defer ws.Close()
+
+ req, err := http.NewRequest("UNKNOWN", ws.URL+"/api/v3/projects/123/repository/not/special", nil)
+ require.NoError(t, err)
+
+ resp, err := http.DefaultClient.Do(req)
+ require.NoError(t, err)
+ defer resp.Body.Close()
+
+ require.Equal(t, http.StatusMethodNotAllowed, resp.StatusCode)
+}
+
func setupStaticFile(fpath, content string) error {
return setupStaticFileHelper(fpath, content, testDocumentRoot)
}