Commit 91eba767 authored by Mikolaj Wawrzyniak's avatar Mikolaj Wawrzyniak

Whitelist two projects api endpoints

To allow bug fix as a temporary matter we need to whitelist two
endpoints from projects api:
- POST /projects/user/:id with
- POST /projects
From query limiting middleware
parent eff03da6
......@@ -177,6 +177,7 @@ module API
use :create_params
end
post do
Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab/issues/21139')
attrs = declared_params(include_missing: false)
attrs = translate_params_for_compatibility(attrs)
filter_attributes_using_license!(attrs)
......@@ -209,6 +210,7 @@ module API
end
# rubocop: disable CodeReuse/ActiveRecord
post "user/:user_id" do
Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab/issues/21139')
authenticated_as_admin!
user = User.find_by(id: params.delete(:user_id))
not_found!('User') unless user
......
......@@ -410,6 +410,7 @@ describe Projects::CreateService, '#execute' do
it 'creates PrometheusService record', :aggregate_failures do
project = create_project(user, opts.merge!(namespace_id: group.id))
service = project.prometheus_service
expect(service.active).to be true
expect(service.manual_configuration?).to be false
expect(service.persisted?).to be true
......@@ -426,6 +427,7 @@ describe Projects::CreateService, '#execute' do
it 'creates PrometheusService record', :aggregate_failures do
project = create_project(user, opts)
service = project.prometheus_service
expect(service.active).to be true
expect(service.manual_configuration?).to be false
expect(service.persisted?).to be true
......@@ -447,7 +449,7 @@ describe Projects::CreateService, '#execute' do
context 'shared Prometheus application is not available' do
it 'does not persist PrometheusService record', :aggregate_failures do
project = create_project(user, opts)
expect(project.prometheus_service).to be_nil
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment