From 7d0d9c650e3cbbb1bf05a6fc62dfcd75aa03df39 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Fri, 25 Oct 2013 09:39:31 +0200 Subject: [PATCH 01/10] Restore sidekiq rake tasks --- lib/tasks/sidekiq.rake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/tasks/sidekiq.rake b/lib/tasks/sidekiq.rake index 23d41f8ed2..e91678473a 100644 --- a/lib/tasks/sidekiq.rake +++ b/lib/tasks/sidekiq.rake @@ -4,11 +4,13 @@ namespace :sidekiq do system "script/background_jobs stop" end - desc "GITLAB | Start sidekiq" do + desc "GITLAB | Start sidekiq" + task :start do system "script/background_jobs start" end - desc 'GitLab | Restart sidekiq' do + desc 'GitLab | Restart sidekiq' + task :restart do system "script/background_jobs restart" end From 03141bfccca2b61721a12f3bb17eb6308cfb0ec4 Mon Sep 17 00:00:00 2001 From: Nigel Kukard Date: Tue, 29 Oct 2013 18:06:10 +0000 Subject: [PATCH 02/10] Escape strings Signed-off-by: Nigel Kukard --- lib/gitlab/backend/shell.rb | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/gitlab/backend/shell.rb b/lib/gitlab/backend/shell.rb index c819ce56ac..bcd57ac79b 100644 --- a/lib/gitlab/backend/shell.rb +++ b/lib/gitlab/backend/shell.rb @@ -1,3 +1,5 @@ +require "shellwords" + module Gitlab class Shell class AccessDenied < StandardError; end @@ -10,7 +12,7 @@ module Gitlab # add_repository("gitlab/gitlab-ci") # def add_repository(name) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "add-project", "#{name}.git" + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "add-project", Shellwords.shellwords("#{name}.git") end # Import repository @@ -21,7 +23,7 @@ module Gitlab # import_repository("gitlab/gitlab-ci", "https://github.com/randx/six.git") # def import_repository(name, url) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "import-project", "#{name}.git", url + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "import-project", Shellwords.shellwords("#{name}.git"), Shellwords.shellwords(url) end # Move repository @@ -33,7 +35,7 @@ module Gitlab # mv_repository("gitlab/gitlab-ci", "randx/gitlab-ci-new.git") # def mv_repository(path, new_path) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "mv-project", "#{path}.git", "#{new_path}.git" + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "mv-project", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords("#{new_path}.git") end # Update HEAD for repository @@ -45,7 +47,7 @@ module Gitlab # update_repository_head("gitlab/gitlab-ci", "3-1-stable") # def update_repository_head(path, branch) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "update-head", "#{path}.git", branch + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "update-head", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(branch) end # Fork repository to new namespace @@ -57,7 +59,7 @@ module Gitlab # fork_repository("gitlab/gitlab-ci", "randx") # def fork_repository(path, fork_namespace) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "fork-project", "#{path}.git", fork_namespace + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "fork-project", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(fork_namespace) end # Remove repository from file system @@ -68,7 +70,7 @@ module Gitlab # remove_repository("gitlab/gitlab-ci") # def remove_repository(name) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-project", "#{name}.git" + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-project", Shellwords.shellwords("#{name}.git") end # Add repository branch from passed ref @@ -81,7 +83,7 @@ module Gitlab # add_branch("gitlab/gitlab-ci", "4-0-stable", "master") # def add_branch(path, branch_name, ref) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-branch", "#{path}.git", branch_name, ref + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-branch", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(branch_name), Shellwords.shellwords(ref) end # Remove repository branch @@ -93,7 +95,7 @@ module Gitlab # rm_branch("gitlab/gitlab-ci", "4-0-stable") # def rm_branch(path, branch_name) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-branch", "#{path}.git", branch_name + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-branch", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(branch_name) end # Add repository tag from passed ref @@ -106,7 +108,7 @@ module Gitlab # add_tag("gitlab/gitlab-ci", "v4.0", "master") # def add_tag(path, tag_name, ref) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-tag", "#{path}.git", tag_name, ref + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-tag", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(tag_name), Shellwords.shellwords(ref) end # Remove repository tag @@ -118,7 +120,7 @@ module Gitlab # rm_tag("gitlab/gitlab-ci", "v4.0") # def rm_tag(path, tag_name) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-tag", "#{path}.git", tag_name + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-tag", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(tag_name) end # Add new key to gitlab-shell @@ -127,7 +129,7 @@ module Gitlab # add_key("key-42", "sha-rsa ...") # def add_key(key_id, key_content) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "add-key", key_id, key_content + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "add-key", Shellwords.shellwords(key_id), Shellwords.shellwords(key_content) end # Remove ssh key from gitlab shell @@ -136,7 +138,7 @@ module Gitlab # remove_key("key-342", "sha-rsa ...") # def remove_key(key_id, key_content) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "rm-key", key_id, key_content + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "rm-key", Shellwords.shellwords(key_id), Shellwords.shellwords(key_content) end # Remove all ssh keys from gitlab shell From 1ab324cb6721e374e11f4aac0fab0140f7fdacc5 Mon Sep 17 00:00:00 2001 From: Nigel Kukard Date: Thu, 31 Oct 2013 07:34:11 +0000 Subject: [PATCH 03/10] Best to escape strings not split them Signed-off-by: Nigel Kukard --- lib/gitlab/backend/shell.rb | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/gitlab/backend/shell.rb b/lib/gitlab/backend/shell.rb index bcd57ac79b..4e2a5cd168 100644 --- a/lib/gitlab/backend/shell.rb +++ b/lib/gitlab/backend/shell.rb @@ -12,7 +12,7 @@ module Gitlab # add_repository("gitlab/gitlab-ci") # def add_repository(name) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "add-project", Shellwords.shellwords("#{name}.git") + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "add-project", Shellwords.shellescape("#{name}.git") end # Import repository @@ -23,7 +23,7 @@ module Gitlab # import_repository("gitlab/gitlab-ci", "https://github.com/randx/six.git") # def import_repository(name, url) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "import-project", Shellwords.shellwords("#{name}.git"), Shellwords.shellwords(url) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "import-project", Shellwords.shellescape("#{name}.git"), Shellwords.shellescape(url) end # Move repository @@ -35,7 +35,7 @@ module Gitlab # mv_repository("gitlab/gitlab-ci", "randx/gitlab-ci-new.git") # def mv_repository(path, new_path) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "mv-project", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords("#{new_path}.git") + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "mv-project", Shellwords.shellescape("#{path}.git"), Shellwords.shellescape("#{new_path}.git") end # Update HEAD for repository @@ -47,7 +47,7 @@ module Gitlab # update_repository_head("gitlab/gitlab-ci", "3-1-stable") # def update_repository_head(path, branch) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "update-head", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(branch) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "update-head", Shellwords.shellescape("#{path}.git"), Shellwords.shellescape(branch) end # Fork repository to new namespace @@ -59,18 +59,18 @@ module Gitlab # fork_repository("gitlab/gitlab-ci", "randx") # def fork_repository(path, fork_namespace) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "fork-project", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(fork_namespace) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "fork-project", Shellwords.shellescape("#{path}.git"), Shellwords.shellescape(fork_namespace) end # Remove repository from file system # - # name - project path with namespace + # path - project path with namespace # # Ex. # remove_repository("gitlab/gitlab-ci") # - def remove_repository(name) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-project", Shellwords.shellwords("#{name}.git") + def remove_repository(path) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-project", Shellwords.shellescape("#{path}.git") end # Add repository branch from passed ref @@ -83,7 +83,7 @@ module Gitlab # add_branch("gitlab/gitlab-ci", "4-0-stable", "master") # def add_branch(path, branch_name, ref) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-branch", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(branch_name), Shellwords.shellwords(ref) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-branch", Shellwords.shellescape("#{path}.git"), Shellwords.shellescape(branch_name), Shellwords.shellescape(ref) end # Remove repository branch @@ -95,7 +95,7 @@ module Gitlab # rm_branch("gitlab/gitlab-ci", "4-0-stable") # def rm_branch(path, branch_name) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-branch", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(branch_name) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-branch", Shellwords.shellescape("#{path}.git"), Shellwords.shellescape(branch_name) end # Add repository tag from passed ref @@ -108,7 +108,7 @@ module Gitlab # add_tag("gitlab/gitlab-ci", "v4.0", "master") # def add_tag(path, tag_name, ref) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-tag", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(tag_name), Shellwords.shellwords(ref) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-tag", Shellwords.shellescape("#{path}.git"), Shellwords.shellescape(tag_name), Shellwords.shellescape(ref) end # Remove repository tag @@ -120,7 +120,7 @@ module Gitlab # rm_tag("gitlab/gitlab-ci", "v4.0") # def rm_tag(path, tag_name) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-tag", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(tag_name) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-tag", Shellwords.shellescape("#{path}.git"), Shellwords.shellescape(tag_name) end # Add new key to gitlab-shell @@ -129,7 +129,7 @@ module Gitlab # add_key("key-42", "sha-rsa ...") # def add_key(key_id, key_content) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "add-key", Shellwords.shellwords(key_id), Shellwords.shellwords(key_content) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "add-key", Shellwords.shellescape(key_id), Shellwords.shellescape(key_content) end # Remove ssh key from gitlab shell @@ -138,7 +138,7 @@ module Gitlab # remove_key("key-342", "sha-rsa ...") # def remove_key(key_id, key_content) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "rm-key", Shellwords.shellwords(key_id), Shellwords.shellwords(key_content) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "rm-key", Shellwords.shellescape(key_id), Shellwords.shellescape(key_content) end # Remove all ssh keys from gitlab shell From 1bace9da9abdacb7df91421548a8f3c66031ddfd Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 31 Oct 2013 19:48:39 +0200 Subject: [PATCH 04/10] Require gitlab-shell v1.7.3 --- lib/tasks/gitlab/check.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index e01f3b23d0..c4f1eba9b9 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -736,7 +736,7 @@ namespace :gitlab do end def check_gitlab_shell - required_version = Gitlab::VersionInfo.new(1, 7, 1) + required_version = Gitlab::VersionInfo.new(1, 7, 3) current_version = Gitlab::VersionInfo.parse(gitlab_shell_version) print "GitLab Shell version >= #{required_version} ? ... " From a476bc7bc7bd902e4bc2dbf9d49d3f6cb9e61537 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 31 Oct 2013 11:25:08 +0200 Subject: [PATCH 05/10] Shell escape code search --- app/contexts/search_context.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/contexts/search_context.rb b/app/contexts/search_context.rb index 48def0784f..ff32297855 100644 --- a/app/contexts/search_context.rb +++ b/app/contexts/search_context.rb @@ -6,7 +6,7 @@ class SearchContext end def execute - query = params[:search] + query = Shellwords.shellescape(params[:search]) return result unless query.present? From 31736e9be83da6cf45d5331790bd39b230bbc1f6 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 31 Oct 2013 16:35:06 +0200 Subject: [PATCH 06/10] Correctly escape search query --- app/contexts/search_context.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/contexts/search_context.rb b/app/contexts/search_context.rb index ff32297855..c07fdfe4c3 100644 --- a/app/contexts/search_context.rb +++ b/app/contexts/search_context.rb @@ -6,7 +6,8 @@ class SearchContext end def execute - query = Shellwords.shellescape(params[:search]) + query = params[:search] + query = Shellwords.shellescape(query) if query.present? return result unless query.present? From 9f9d9cff0dbec92a31296da85460c82c9f826b8a Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 1 Nov 2013 16:30:18 +0200 Subject: [PATCH 07/10] Revert "Best to escape strings not split them" This reverts commit 1ab324cb6721e374e11f4aac0fab0140f7fdacc5. --- lib/gitlab/backend/shell.rb | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/gitlab/backend/shell.rb b/lib/gitlab/backend/shell.rb index 4e2a5cd168..bcd57ac79b 100644 --- a/lib/gitlab/backend/shell.rb +++ b/lib/gitlab/backend/shell.rb @@ -12,7 +12,7 @@ module Gitlab # add_repository("gitlab/gitlab-ci") # def add_repository(name) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "add-project", Shellwords.shellescape("#{name}.git") + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "add-project", Shellwords.shellwords("#{name}.git") end # Import repository @@ -23,7 +23,7 @@ module Gitlab # import_repository("gitlab/gitlab-ci", "https://github.com/randx/six.git") # def import_repository(name, url) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "import-project", Shellwords.shellescape("#{name}.git"), Shellwords.shellescape(url) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "import-project", Shellwords.shellwords("#{name}.git"), Shellwords.shellwords(url) end # Move repository @@ -35,7 +35,7 @@ module Gitlab # mv_repository("gitlab/gitlab-ci", "randx/gitlab-ci-new.git") # def mv_repository(path, new_path) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "mv-project", Shellwords.shellescape("#{path}.git"), Shellwords.shellescape("#{new_path}.git") + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "mv-project", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords("#{new_path}.git") end # Update HEAD for repository @@ -47,7 +47,7 @@ module Gitlab # update_repository_head("gitlab/gitlab-ci", "3-1-stable") # def update_repository_head(path, branch) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "update-head", Shellwords.shellescape("#{path}.git"), Shellwords.shellescape(branch) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "update-head", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(branch) end # Fork repository to new namespace @@ -59,18 +59,18 @@ module Gitlab # fork_repository("gitlab/gitlab-ci", "randx") # def fork_repository(path, fork_namespace) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "fork-project", Shellwords.shellescape("#{path}.git"), Shellwords.shellescape(fork_namespace) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "fork-project", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(fork_namespace) end # Remove repository from file system # - # path - project path with namespace + # name - project path with namespace # # Ex. # remove_repository("gitlab/gitlab-ci") # - def remove_repository(path) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-project", Shellwords.shellescape("#{path}.git") + def remove_repository(name) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-project", Shellwords.shellwords("#{name}.git") end # Add repository branch from passed ref @@ -83,7 +83,7 @@ module Gitlab # add_branch("gitlab/gitlab-ci", "4-0-stable", "master") # def add_branch(path, branch_name, ref) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-branch", Shellwords.shellescape("#{path}.git"), Shellwords.shellescape(branch_name), Shellwords.shellescape(ref) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-branch", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(branch_name), Shellwords.shellwords(ref) end # Remove repository branch @@ -95,7 +95,7 @@ module Gitlab # rm_branch("gitlab/gitlab-ci", "4-0-stable") # def rm_branch(path, branch_name) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-branch", Shellwords.shellescape("#{path}.git"), Shellwords.shellescape(branch_name) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-branch", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(branch_name) end # Add repository tag from passed ref @@ -108,7 +108,7 @@ module Gitlab # add_tag("gitlab/gitlab-ci", "v4.0", "master") # def add_tag(path, tag_name, ref) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-tag", Shellwords.shellescape("#{path}.git"), Shellwords.shellescape(tag_name), Shellwords.shellescape(ref) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-tag", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(tag_name), Shellwords.shellwords(ref) end # Remove repository tag @@ -120,7 +120,7 @@ module Gitlab # rm_tag("gitlab/gitlab-ci", "v4.0") # def rm_tag(path, tag_name) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-tag", Shellwords.shellescape("#{path}.git"), Shellwords.shellescape(tag_name) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-tag", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(tag_name) end # Add new key to gitlab-shell @@ -129,7 +129,7 @@ module Gitlab # add_key("key-42", "sha-rsa ...") # def add_key(key_id, key_content) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "add-key", Shellwords.shellescape(key_id), Shellwords.shellescape(key_content) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "add-key", Shellwords.shellwords(key_id), Shellwords.shellwords(key_content) end # Remove ssh key from gitlab shell @@ -138,7 +138,7 @@ module Gitlab # remove_key("key-342", "sha-rsa ...") # def remove_key(key_id, key_content) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "rm-key", Shellwords.shellescape(key_id), Shellwords.shellescape(key_content) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "rm-key", Shellwords.shellwords(key_id), Shellwords.shellwords(key_content) end # Remove all ssh keys from gitlab shell From 33b041a346795b80d48ed1b200227d0ab4c4bcca Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 1 Nov 2013 16:30:29 +0200 Subject: [PATCH 08/10] Revert "Escape strings" This reverts commit 03141bfccca2b61721a12f3bb17eb6308cfb0ec4. --- lib/gitlab/backend/shell.rb | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/lib/gitlab/backend/shell.rb b/lib/gitlab/backend/shell.rb index bcd57ac79b..c819ce56ac 100644 --- a/lib/gitlab/backend/shell.rb +++ b/lib/gitlab/backend/shell.rb @@ -1,5 +1,3 @@ -require "shellwords" - module Gitlab class Shell class AccessDenied < StandardError; end @@ -12,7 +10,7 @@ module Gitlab # add_repository("gitlab/gitlab-ci") # def add_repository(name) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "add-project", Shellwords.shellwords("#{name}.git") + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "add-project", "#{name}.git" end # Import repository @@ -23,7 +21,7 @@ module Gitlab # import_repository("gitlab/gitlab-ci", "https://github.com/randx/six.git") # def import_repository(name, url) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "import-project", Shellwords.shellwords("#{name}.git"), Shellwords.shellwords(url) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "import-project", "#{name}.git", url end # Move repository @@ -35,7 +33,7 @@ module Gitlab # mv_repository("gitlab/gitlab-ci", "randx/gitlab-ci-new.git") # def mv_repository(path, new_path) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "mv-project", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords("#{new_path}.git") + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "mv-project", "#{path}.git", "#{new_path}.git" end # Update HEAD for repository @@ -47,7 +45,7 @@ module Gitlab # update_repository_head("gitlab/gitlab-ci", "3-1-stable") # def update_repository_head(path, branch) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "update-head", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(branch) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "update-head", "#{path}.git", branch end # Fork repository to new namespace @@ -59,7 +57,7 @@ module Gitlab # fork_repository("gitlab/gitlab-ci", "randx") # def fork_repository(path, fork_namespace) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "fork-project", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(fork_namespace) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "fork-project", "#{path}.git", fork_namespace end # Remove repository from file system @@ -70,7 +68,7 @@ module Gitlab # remove_repository("gitlab/gitlab-ci") # def remove_repository(name) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-project", Shellwords.shellwords("#{name}.git") + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-project", "#{name}.git" end # Add repository branch from passed ref @@ -83,7 +81,7 @@ module Gitlab # add_branch("gitlab/gitlab-ci", "4-0-stable", "master") # def add_branch(path, branch_name, ref) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-branch", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(branch_name), Shellwords.shellwords(ref) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-branch", "#{path}.git", branch_name, ref end # Remove repository branch @@ -95,7 +93,7 @@ module Gitlab # rm_branch("gitlab/gitlab-ci", "4-0-stable") # def rm_branch(path, branch_name) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-branch", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(branch_name) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-branch", "#{path}.git", branch_name end # Add repository tag from passed ref @@ -108,7 +106,7 @@ module Gitlab # add_tag("gitlab/gitlab-ci", "v4.0", "master") # def add_tag(path, tag_name, ref) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-tag", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(tag_name), Shellwords.shellwords(ref) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-tag", "#{path}.git", tag_name, ref end # Remove repository tag @@ -120,7 +118,7 @@ module Gitlab # rm_tag("gitlab/gitlab-ci", "v4.0") # def rm_tag(path, tag_name) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-tag", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(tag_name) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-tag", "#{path}.git", tag_name end # Add new key to gitlab-shell @@ -129,7 +127,7 @@ module Gitlab # add_key("key-42", "sha-rsa ...") # def add_key(key_id, key_content) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "add-key", Shellwords.shellwords(key_id), Shellwords.shellwords(key_content) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "add-key", key_id, key_content end # Remove ssh key from gitlab shell @@ -138,7 +136,7 @@ module Gitlab # remove_key("key-342", "sha-rsa ...") # def remove_key(key_id, key_content) - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "rm-key", Shellwords.shellwords(key_id), Shellwords.shellwords(key_content) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "rm-key", key_id, key_content end # Remove all ssh keys from gitlab shell From 2d56ef52d255f44e63c7db9b23bad723867beb49 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 1 Nov 2013 16:58:24 +0200 Subject: [PATCH 09/10] Require gitlab-shell 1.7.4 Signed-off-by: Dmitriy Zaporozhets --- lib/tasks/gitlab/check.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index c4f1eba9b9..3c92dac8b8 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -736,7 +736,7 @@ namespace :gitlab do end def check_gitlab_shell - required_version = Gitlab::VersionInfo.new(1, 7, 3) + required_version = Gitlab::VersionInfo.new(1, 7, 4) current_version = Gitlab::VersionInfo.parse(gitlab_shell_version) print "GitLab Shell version >= #{required_version} ? ... " From 867785b492011894df1c1660150f105f80ccc30f Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Fri, 1 Nov 2013 16:34:00 +0100 Subject: [PATCH 10/10] Use gitlab-shell 1.7.4 --- doc/install/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/install/installation.md b/doc/install/installation.md index c89ae57f71..f7bea2727d 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -122,7 +122,7 @@ GitLab Shell is an ssh access and repository management software developed speci cd gitlab-shell # switch to right version - sudo -u git -H git checkout v1.7.1 + sudo -u git -H git checkout v1.7.4 sudo -u git -H cp config.yml.example config.yml