summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2018-03-06 15:17:00 +0100
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2018-03-06 15:17:00 +0100
commit3c0f6da546548a1cda969a92a250222bc96616c7 (patch)
tree3dfa50032e8c9d1666776ac72f4d8e9c4284bb5e
parent5e8138aa54492dd3ace42d889ba01f82e8e19c83 (diff)
downloadgitlab-ce-3c0f6da546548a1cda969a92a250222bc96616c7.tar.gz
Make git push mandatory
-rw-r--r--lib/api/helpers/internal_helpers.rb7
-rw-r--r--lib/gitlab/workhorse.rb22
2 files changed, 4 insertions, 25 deletions
diff --git a/lib/api/helpers/internal_helpers.rb b/lib/api/helpers/internal_helpers.rb
index cd59da6fc70..4b564cfdef2 100644
--- a/lib/api/helpers/internal_helpers.rb
+++ b/lib/api/helpers/internal_helpers.rb
@@ -111,13 +111,6 @@ module API
def gitaly_payload(action)
return unless %w[git-receive-pack git-upload-pack].include?(action)
- if action == 'git-receive-pack'
- return unless Gitlab::GitalyClient.feature_enabled?(
- :ssh_receive_pack,
- status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT
- )
- end
-
{
repository: repository.gitaly_repository,
address: Gitlab::GitalyClient.address(project.repository_storage),
diff --git a/lib/gitlab/workhorse.rb b/lib/gitlab/workhorse.rb
index 823df67ea39..c309cb587e7 100644
--- a/lib/gitlab/workhorse.rb
+++ b/lib/gitlab/workhorse.rb
@@ -10,6 +10,7 @@ module Gitlab
INTERNAL_API_CONTENT_TYPE = 'application/vnd.gitlab-workhorse+json'.freeze
INTERNAL_API_REQUEST_HEADER = 'Gitlab-Workhorse-Api-Request'.freeze
NOTIFICATION_CHANNEL = 'workhorse:notifications'.freeze
+ ALLOWED_ACTIONS = %w[git_receive_pack git_upload_pack info_refs].freeze
# Supposedly the effective key size for HMAC-SHA256 is 256 bits, i.e. 32
# bytes https://tools.ietf.org/html/rfc4868#section-2.6
@@ -17,6 +18,8 @@ module Gitlab
class << self
def git_http_ok(repository, is_wiki, user, action, show_all_refs: false)
+ raise "Unsupported action: #{action}" unless ALLOWED_ACTIONS.include?(action.to_s)
+
project = repository.project
repo_path = repository.path_to_repo
params = {
@@ -31,24 +34,7 @@ module Gitlab
token: Gitlab::GitalyClient.token(project.repository_storage)
}
params[:Repository] = repository.gitaly_repository.to_h
-
- feature_enabled = case action.to_s
- when 'git_receive_pack'
- Gitlab::GitalyClient.feature_enabled?(
- :post_receive_pack,
- status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT
- )
- when 'git_upload_pack'
- true
- when 'info_refs'
- true
- else
- raise "Unsupported action: #{action}"
- end
-
- if feature_enabled
- params[:GitalyServer] = server
- end
+ params[:GitalyServer] = server
params
end