summaryrefslogtreecommitdiff
path: root/lib/gitlab_shell.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-07-06 15:24:22 +0000
committerDouwe Maan <douwe@gitlab.com>2016-07-06 15:24:22 +0000
commitdd6eed168d75030a028da4f1ba5b5f1483de395a (patch)
treeebcf8c577cf09061803be5dddf60a0abda04450f /lib/gitlab_shell.rb
parent5afdd3f1cc3f12d4e919edb554c755b227675d06 (diff)
parent02b8071c60f26318d660864450ca869cc8e6b7cf (diff)
downloadgitlab-shell-dd6eed168d75030a028da4f1ba5b5f1483de395a.tar.gz
Merge branch 'add-allowed-protocols-support' into 'master'
Allow GitLab Shell to check for allowed access based on the used Git protocol. Needed for gitlab-org/gitlab-ce!4696 and gitlab-org/gitlab-ce#18601 See merge request !62
Diffstat (limited to 'lib/gitlab_shell.rb')
-rw-r--r--lib/gitlab_shell.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb
index c5d5c02..d9812ce 100644
--- a/lib/gitlab_shell.rb
+++ b/lib/gitlab_shell.rb
@@ -8,6 +8,7 @@ class GitlabShell
class InvalidRepositoryPathError < StandardError; end
GIT_COMMANDS = %w(git-upload-pack git-receive-pack git-upload-archive git-annex-shell git-lfs-authenticate).freeze
+ GL_PROTOCOL = 'ssh'.freeze
attr_accessor :key_id, :repo_name, :git_cmd
attr_reader :repo_path
@@ -85,7 +86,7 @@ class GitlabShell
end
def verify_access
- status = api.check_access(@git_access, @repo_name, @key_id, '_any')
+ status = api.check_access(@git_access, @repo_name, @key_id, '_any', GL_PROTOCOL)
raise AccessDeniedError, status.message unless status.allowed?
@@ -131,7 +132,8 @@ class GitlabShell
'PATH' => ENV['PATH'],
'LD_LIBRARY_PATH' => ENV['LD_LIBRARY_PATH'],
'LANG' => ENV['LANG'],
- 'GL_ID' => @key_id
+ 'GL_ID' => @key_id,
+ 'GL_PROTOCOL' => GL_PROTOCOL
}
if @config.git_annex_enabled?