Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKerri Miller <kerrizor@kerrizor.com>2019-07-05 20:26:44 +0300
committerJacob Vosmaer <jacob@gitlab.com>2019-07-26 15:10:04 +0300
commita45eff0b80fcea5761710efaa22c1d7b6b1f751c (patch)
tree94acb449e152daea4039218fe2eb9e40e55d4d89
parent95278cbfb7aca9c4e3c9b6ce981ed637c11c42d7 (diff)
Hardcode http.followRedirects as "false"
Feedback from @jacobvosmaer was YAGNI, and I agree, especially in the context of this coming in for a security fix.
-rw-r--r--ruby/lib/gitlab/git/gitlab_projects.rb8
-rw-r--r--ruby/spec/lib/gitlab/git/gitlab_projects_spec.rb13
2 files changed, 5 insertions, 16 deletions
diff --git a/ruby/lib/gitlab/git/gitlab_projects.rb b/ruby/lib/gitlab/git/gitlab_projects.rb
index f56c7b1d7..bc3859fb4 100644
--- a/ruby/lib/gitlab/git/gitlab_projects.rb
+++ b/ruby/lib/gitlab/git/gitlab_projects.rb
@@ -57,9 +57,9 @@ module Gitlab
end
end
- def fetch_remote(name, timeout, force:, tags:, env: {}, prune: true, follow_redirects: false)
+ def fetch_remote(name, timeout, force:, tags:, env: {}, prune: true)
logger.info "Fetching remote #{name} for repository #{repository_absolute_path}."
- cmd = fetch_remote_command(name, tags, prune, force, follow_redirects)
+ cmd = fetch_remote_command(name, tags, prune, force)
run_with_timeout(cmd, timeout, repository_absolute_path, env).tap do |success|
logger.error "Fetching remote #{name} for repository #{repository_absolute_path} failed." unless success
@@ -119,8 +119,8 @@ module Gitlab
private
- def fetch_remote_command(name, tags, prune, force, follow_redirects)
- %W(#{Gitlab.config.git.bin_path} -c http.followRedirects=#{follow_redirects} fetch #{name} --quiet).tap do |cmd|
+ def fetch_remote_command(name, tags, prune, force)
+ %W(#{Gitlab.config.git.bin_path} -c http.followRedirects=false fetch #{name} --quiet).tap do |cmd|
cmd << '--prune' if prune
cmd << '--force' if force
cmd << (tags ? '--tags' : '--no-tags')
diff --git a/ruby/spec/lib/gitlab/git/gitlab_projects_spec.rb b/ruby/spec/lib/gitlab/git/gitlab_projects_spec.rb
index 211e6533a..85122ede6 100644
--- a/ruby/spec/lib/gitlab/git/gitlab_projects_spec.rb
+++ b/ruby/spec/lib/gitlab/git/gitlab_projects_spec.rb
@@ -95,7 +95,7 @@ describe Gitlab::Git::GitlabProjects do
let(:env) { { 'GIT_SSH_COMMAND' => 'foo-command bar' } }
let(:prune) { true }
let(:follow_redirects) { false }
- let(:args) { { force: force, tags: tags, env: env, prune: prune, follow_redirects: follow_redirects } }
+ let(:args) { { force: force, tags: tags, env: env, prune: prune } }
let(:cmd) { %W(#{Gitlab.config.git.bin_path} -c http.followRedirects=false fetch #{remote_name} --quiet --prune --tags) }
subject { gl_projects.fetch_remote(remote_name, 600, args) }
@@ -146,17 +146,6 @@ describe Gitlab::Git::GitlabProjects do
is_expected.to be_truthy
end
end
-
- context 'with follow_redirects = true' do
- let(:follow_redirects) { true }
- let(:cmd) { %W(#{Gitlab.config.git.bin_path} -c http.followRedirects=true fetch #{remote_name} --quiet --prune --tags) }
-
- it 'executes the command' do
- stub_spawn(cmd, 600, tmp_repo_path, env, success: true)
-
- is_expected.to be_truthy
- end
- end
end
describe '#delete_remote_branches' do