From 7b4d29f4b5b02b5aee3e3cbfc8282965a38c4622 Mon Sep 17 00:00:00 2001 From: Alexis Reigel Date: Wed, 22 Feb 2017 16:24:48 +0100 Subject: add profile gpg key page to manage gpg keys --- config/routes/profile.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'config') diff --git a/config/routes/profile.rb b/config/routes/profile.rb index 3dc890e5785..00388b9c0cd 100644 --- a/config/routes/profile.rb +++ b/config/routes/profile.rb @@ -23,6 +23,7 @@ resource :profile, only: [:show, :update] do end resource :preferences, only: [:show, :update] resources :keys, only: [:index, :show, :create, :destroy] + resources :gpg_keys, only: [:index, :create, :destroy] resources :emails, only: [:index, :create, :destroy] resources :chat_names, only: [:index, :new, :create, :destroy] do collection do -- cgit v1.2.1 From 9816856d055b33de9c47d9e3b73c4acb99c5b5e6 Mon Sep 17 00:00:00 2001 From: Alexis Reigel Date: Thu, 22 Jun 2017 14:18:01 +0200 Subject: perform signature update in sidekiq worker --- config/sidekiq_queues.yml | 1 + 1 file changed, 1 insertion(+) (limited to 'config') diff --git a/config/sidekiq_queues.yml b/config/sidekiq_queues.yml index 1d9e69a2408..cf0f5719683 100644 --- a/config/sidekiq_queues.yml +++ b/config/sidekiq_queues.yml @@ -29,6 +29,7 @@ - [email_receiver, 2] - [emails_on_push, 2] - [mailers, 2] + - [invalid_gpg_signature_update, 2] - [upload_checksum, 1] - [use_key, 1] - [repository_fork, 1] -- cgit v1.2.1 From e63b693f28bf752f617bd0aa2f375db701d1600a Mon Sep 17 00:00:00 2001 From: Alexis Reigel Date: Mon, 10 Jul 2017 13:19:50 +0200 Subject: generate gpg signature on push --- config/sidekiq_queues.yml | 1 + 1 file changed, 1 insertion(+) (limited to 'config') diff --git a/config/sidekiq_queues.yml b/config/sidekiq_queues.yml index cf0f5719683..7496bfa4fbb 100644 --- a/config/sidekiq_queues.yml +++ b/config/sidekiq_queues.yml @@ -30,6 +30,7 @@ - [emails_on_push, 2] - [mailers, 2] - [invalid_gpg_signature_update, 2] + - [create_gpg_signature, 2] - [upload_checksum, 1] - [use_key, 1] - [repository_fork, 1] -- cgit v1.2.1 From 027309eb2ae54614a2ee1a0ca9e4cea76a86b94b Mon Sep 17 00:00:00 2001 From: Alexis Reigel Date: Wed, 12 Jul 2017 07:59:28 +0200 Subject: user may now revoke a gpg key other than just removing a key, which doesn't affect the verified state of a commit, revoking a key unverifies all signed commits. --- config/routes/profile.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'config') diff --git a/config/routes/profile.rb b/config/routes/profile.rb index 00388b9c0cd..3e4e6111ab8 100644 --- a/config/routes/profile.rb +++ b/config/routes/profile.rb @@ -23,7 +23,11 @@ resource :profile, only: [:show, :update] do end resource :preferences, only: [:show, :update] resources :keys, only: [:index, :show, :create, :destroy] - resources :gpg_keys, only: [:index, :create, :destroy] + resources :gpg_keys, only: [:index, :create, :destroy] do + member do + put :revoke + end + end resources :emails, only: [:index, :create, :destroy] resources :chat_names, only: [:index, :new, :create, :destroy] do collection do -- cgit v1.2.1 From eda001565c5afbf6e2eb9b8b5cf4fa9d6525ed71 Mon Sep 17 00:00:00 2001 From: Alexis Reigel Date: Tue, 25 Jul 2017 09:40:23 +0200 Subject: fetch gpg signature badges by ajax --- config/routes/repository.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'config') diff --git a/config/routes/repository.rb b/config/routes/repository.rb index 11911636fa7..edcf3ddf57b 100644 --- a/config/routes/repository.rb +++ b/config/routes/repository.rb @@ -76,6 +76,8 @@ scope format: false do get '/tree/*id', to: 'tree#show', as: :tree get '/raw/*id', to: 'raw#show', as: :raw get '/blame/*id', to: 'blame#show', as: :blame + + get '/commits/*id/signatures', to: 'commits#signatures', as: :signatures get '/commits/*id', to: 'commits#show', as: :commits post '/create_dir/*id', to: 'tree#create_dir', as: :create_dir -- cgit v1.2.1 From ce4e0837c4ce11ad31c7be487d08bf44d961ec6f Mon Sep 17 00:00:00 2001 From: Alexis Reigel Date: Tue, 25 Jul 2017 10:02:13 +0200 Subject: mysql hack: set length for binary indexes --- .../mysql_set_length_for_binary_indexes.rb | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 config/initializers/mysql_set_length_for_binary_indexes.rb (limited to 'config') diff --git a/config/initializers/mysql_set_length_for_binary_indexes.rb b/config/initializers/mysql_set_length_for_binary_indexes.rb new file mode 100644 index 00000000000..b5c6e39f6a8 --- /dev/null +++ b/config/initializers/mysql_set_length_for_binary_indexes.rb @@ -0,0 +1,25 @@ +# This patches ActiveRecord so indexes for binary columns created using the +# MySQL adapter apply a length of 20. Otherwise MySQL can't create an index on +# binary columns. + +if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter) + module ActiveRecord + module ConnectionAdapters + class Mysql2Adapter < AbstractMysqlAdapter + alias_method :__gitlab_add_index2, :add_index + + def add_index(table_name, column_names, options = {}) + Array(column_names).each do |column_name| + column = ActiveRecord::Base.connection.columns(table_name).find { |c| c.name == column_name } + + if column&.type == :binary + options[:length] = 20 + end + end + + __gitlab_add_index2(table_name, column_names, options) + end + end + end + end +end -- cgit v1.2.1 From 07dbd5649ad18e4473c10ef8a1a70ea863b88cc4 Mon Sep 17 00:00:00 2001 From: Alexis Reigel Date: Tue, 25 Jul 2017 16:45:13 +0200 Subject: use Module#prepend instead of alias_method_chain --- .../mysql_set_length_for_binary_indexes.rb | 28 ++++++++++------------ 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'config') diff --git a/config/initializers/mysql_set_length_for_binary_indexes.rb b/config/initializers/mysql_set_length_for_binary_indexes.rb index b5c6e39f6a8..de0bc5322aa 100644 --- a/config/initializers/mysql_set_length_for_binary_indexes.rb +++ b/config/initializers/mysql_set_length_for_binary_indexes.rb @@ -2,24 +2,20 @@ # MySQL adapter apply a length of 20. Otherwise MySQL can't create an index on # binary columns. -if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter) - module ActiveRecord - module ConnectionAdapters - class Mysql2Adapter < AbstractMysqlAdapter - alias_method :__gitlab_add_index2, :add_index - - def add_index(table_name, column_names, options = {}) - Array(column_names).each do |column_name| - column = ActiveRecord::Base.connection.columns(table_name).find { |c| c.name == column_name } +module MysqlSetLengthForBinaryIndex + def add_index(table_name, column_names, options = {}) + Array(column_names).each do |column_name| + column = ActiveRecord::Base.connection.columns(table_name).find { |c| c.name == column_name } - if column&.type == :binary - options[:length] = 20 - end - end - - __gitlab_add_index2(table_name, column_names, options) - end + if column&.type == :binary + options[:length] = 20 end end + + super(table_name, column_names, options) end end + +if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter) + ActiveRecord::ConnectionAdapters::Mysql2Adapter.send(:prepend, MysqlSetLengthForBinaryIndex) +end -- cgit v1.2.1