summaryrefslogtreecommitdiff
path: root/lib/gitlab/backend
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <Thomas.Guyot-Sionnest@nuance.com>2013-12-04 18:07:14 -0500
committerThomas Guyot-Sionnest <Thomas.Guyot-Sionnest@nuance.com>2013-12-16 12:39:54 -0500
commit843548cc7681e600b1180a91a407385b35c7f23c (patch)
tree1c0f0d9d67c00edc76c8bee18c83664ce4cca076 /lib/gitlab/backend
parent23d180f5f1905eb8d714daaf2d097767ff355817 (diff)
downloadgitlab-ce-843548cc7681e600b1180a91a407385b35c7f23c.tar.gz
Fix HTTP push to public repos
When doing an HTTP push, git (as of v1.7.9) first do an info/refs request, and only if this request requires authentication it asks the user for its password and authenticates further requests. The initial request normally clears without auth on public repos as it doesn't update any ref. This patch forces every git-receive-pack requests to provide authentication.
Diffstat (limited to 'lib/gitlab/backend')
-rw-r--r--lib/gitlab/backend/grack_auth.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/gitlab/backend/grack_auth.rb b/lib/gitlab/backend/grack_auth.rb
index c629144118c..60c03ce1c04 100644
--- a/lib/gitlab/backend/grack_auth.rb
+++ b/lib/gitlab/backend/grack_auth.rb
@@ -92,6 +92,9 @@ module Grack
return false unless can?(user, action, project)
end
+ # Never let git-receive-pack trough unauthenticated; it's
+ # harmless but git < 1.8 doesn't like it
+ return false if user.nil?
true
else
false