Skip to content
Snippets Groups Projects
Commit f10ed2fb authored by 🤖 GitLab Bot 🤖's avatar 🤖 GitLab Bot 🤖
Browse files

Automatic merge of gitlab-org/gitlab master

parents b681a0b7 fe71dc33
No related branches found
No related tags found
1 merge request!170053Security patch upgrade alert: Only expose to admins 17-4
Showing
with 89 additions and 43 deletions
# frozen_string_literal: true
if Gem::Version.new(ActiveRecord.gem_version) >= Gem::Version.new('7.1.0')
raise "This patch is not needed in Rails 7.1 and up"
unless Gitlab.next_rails?
ActiveRecord::ConnectionAdapters::ConnectionPool.prepend(Gitlab::Patch::ActiveRecordConnectionPool)
end
ActiveRecord::ConnectionAdapters::ConnectionPool.prepend(Gitlab::Patch::ActiveRecordConnectionPool)
# frozen_string_literal: true
class AddCorrectWorkItemTypeIdToIssues < Gitlab::Database::Migration[2.2]
milestone '17.5'
def change
# Defaulting to 0 here to avoid validating the not null constraint afterwards as done in
# https://gitlab.com/gitlab-org/gitlab/-/blob/a24ea906d46589c3397660eaf3223d5af6ad9708/lib/gitlab/database/migration_helpers.rb#L1182-1182
add_column :issues, :correct_work_item_type_id, :bigint, null: false, default: 0
end
end
c639561ee0c0025af7d34f71b7aa213727157128d5ca7fd1a72c7716bb8dcfc5
\ No newline at end of file
......@@ -12636,6 +12636,7 @@ CREATE TABLE issues (
start_date date,
tmp_epic_id bigint,
imported_from smallint DEFAULT 0 NOT NULL,
correct_work_item_type_id bigint DEFAULT 0 NOT NULL,
CONSTRAINT check_2addf801cd CHECK ((work_item_type_id IS NOT NULL)),
CONSTRAINT check_c33362cd43 CHECK ((namespace_id IS NOT NULL)),
CONSTRAINT check_fba63f706d CHECK ((lock_version IS NOT NULL))
......@@ -26,7 +26,7 @@ def resolve(id:)
end
def find_object(id:)
GlobalID::Locator.locate(id)
GitlabSchema.object_from_id(id)
end
end
end
......
......@@ -64,7 +64,7 @@ def resolve(id:, **args)
end
def find_object(id:)
GlobalID::Locator.locate(id)
GitlabSchema.object_from_id(id)
end
def permitted_params
......
......@@ -35,19 +35,18 @@
end
context 'with an invalid global id' do
let(:mutation_with_invalid_id) do
let(:mutation) do
graphql_mutation(
:project_security_exclusion_delete,
id: "gid://gitlab/ProjectSecurityExclusion/#{non_existing_record_id}"
id: "gid://gitlab/Security::ProjectSecurityExclusion/#{non_existing_record_id}"
)
end
it 'returns an error' do
expect { post_graphql_mutation(mutation_with_invalid_id, current_user: current_user) }
.not_to change { Security::ProjectSecurityExclusion.count }
expect { mutation_response }.to raise_error(GraphqlHelpers::NoData)
before do
post_graphql_mutation(mutation, current_user: current_user)
end
it_behaves_like 'a mutation on an unauthorized resource'
end
context 'when delete fails' do
......
......@@ -71,6 +71,21 @@
)
end
end
context 'with an invalid global id' do
let(:mutation) do
graphql_mutation(
:project_security_exclusion_update,
id: "gid://gitlab/Security::ProjectSecurityExclusion/#{non_existing_record_id}"
)
end
before do
post_graphql_mutation(mutation, current_user: current_user)
end
it_behaves_like 'a mutation on an unauthorized resource'
end
end
context 'when the feature is not licensed for the project' do
......
......@@ -111,11 +111,10 @@ def force_disconnect!
end
def pool_disconnect!
if Feature.enabled?(:load_balancing_disconnect_without_verify)
pool.disconnect_without_verify!
else
pool.disconnect!
end
return pool.disconnect! if ::Gitlab.next_rails?
return pool.disconnect_without_verify! if Feature.enabled?(:load_balancing_disconnect_without_verify)
pool.disconnect!
end
def offline!
......
......@@ -152,7 +152,7 @@
"deckar01-task_list": "^2.3.1",
"dexie": "^3.2.3",
"diff": "^3.4.0",
"dompurify": "^3.1.6",
"dompurify": "^3.1.7",
"dropzone": "^4.2.0",
"editorconfig": "^0.15.3",
"emoji-regex": "^10.0.0",
......
......@@ -117,7 +117,7 @@
gitlab_subscription_histories: %w[gitlab_subscription_id hosted_plan_id namespace_id],
identities: %w[user_id],
import_failures: %w[project_id],
issues: %w[last_edited_by_id state_id],
issues: %w[last_edited_by_id state_id correct_work_item_type_id], # correct_work_item_type_id is a temp column
issue_emails: %w[email_message_id],
jira_tracker_data: %w[jira_issue_transition_id],
keys: %w[user_id],
......
......@@ -82,20 +82,26 @@ def expect_next_replica_connection
end
end
context 'with load_balancing_disconnect_without_verify feature flag disabled' do
let(:disconnect_method) { :disconnect! }
before do
stub_feature_flags(load_balancing_disconnect_without_verify: false)
end
let(:disconnect_method) { :disconnect! }
if ::Gitlab.next_rails?
it_behaves_like 'disconnects the pool'
end
else
context 'with load_balancing_disconnect_without_verify feature flag disabled' do
let(:disconnect_method) { :disconnect! }
before do
stub_feature_flags(load_balancing_disconnect_without_verify: false)
end
context 'with load_balancing_disconnect_without_verify feature flag enabled' do
let(:disconnect_method) { :disconnect_without_verify! }
it_behaves_like 'disconnects the pool'
end
it_behaves_like 'disconnects the pool'
context 'with load_balancing_disconnect_without_verify feature flag enabled' do
let(:disconnect_method) { :disconnect_without_verify! }
it_behaves_like 'disconnects the pool'
end
end
end
......@@ -109,7 +115,11 @@ def expect_next_replica_connection
describe '#offline!' do
it 'marks the host as offline' do
expect(host.pool).to receive(:disconnect_without_verify!)
if ::Gitlab.next_rails?
expect(host.pool).to receive(:disconnect!)
else
expect(host.pool).to receive(:disconnect_without_verify!)
end
expect(Gitlab::Database::LoadBalancing::Logger).to receive(:warn)
.with(hash_including(event: :host_offline))
......
......@@ -21,22 +21,34 @@
subject(:pool) { ActiveRecord::ConnectionAdapters::ConnectionPool.new(pool_config) }
describe '#disconnect_without_verify!' do
it 'does not call verify!' do
expect(done_connection).not_to receive(:verify!)
unless Gitlab.next_rails?
it 'does not call verify!' do
expect(done_connection).not_to receive(:verify!)
pool.disconnect_without_verify!
pool.disconnect_without_verify!
expect(pool.connections.count).to eq(0)
expect(pool.connections.count).to eq(0)
end
end
end
describe '#disconnect!' do
it 'calls verify on the connection' do
expect(done_connection).to receive(:verify!).and_call_original
if Gitlab.next_rails?
it 'does not call verify on the connection' do
expect(done_connection).not_to receive(:verify!)
pool.disconnect!
pool.disconnect!
expect(pool.connections.count).to eq(0)
expect(pool.connections.count).to eq(0)
end
else
it 'calls verify on the connection' do
expect(done_connection).to receive(:verify!).and_call_original
pool.disconnect!
expect(pool.connections.count).to eq(0)
end
end
end
end
......@@ -6238,10 +6238,10 @@ domexception@^4.0.0:
dependencies:
webidl-conversions "^7.0.0"
 
dompurify@^3.0.5, dompurify@^3.1.6:
version "3.1.6"
resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.1.6.tgz#43c714a94c6a7b8801850f82e756685300a027e2"
integrity sha512-cTOAhc36AalkjtBpfG6O8JimdTMWNXjiePT2xQH/ppBGi/4uIpmj8eKyIkMJErXWARyINV/sB38yf8JCLF5pbQ==
dompurify@^3.0.5, dompurify@^3.1.7:
version "3.1.7"
resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.1.7.tgz#711a8c96479fb6ced93453732c160c3c72418a6a"
integrity sha512-VaTstWtsneJY8xzy7DekmYWEOZcmzIe3Qb3zPd4STve1OBTa+e+WmS1ITQec1fZYXI3HCsOZZiSMpG6oxoWMWQ==
 
dropzone@^4.2.0:
version "4.2.0"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment