summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-02-08 14:44:26 +0000
committerRémy Coutable <remy@rymai.me>2017-02-08 14:44:26 +0000
commitbb4b8091d5f7817c192bac559ab65205982716ef (patch)
treecceba26057195d60e0253a5439eac9b9da57d996
parent0cc6cfc11be21597b11470c1c1aaa7e4a92618db (diff)
parentf85d650e67d199f43259a9181d7c0406571f4bcf (diff)
downloadgitlab-shell-bb4b8091d5f7817c192bac559ab65205982716ef.tar.gz
Merge branch 'backport-112-to-3-6-stable' into '3-6-stable' v3.6.73-6-stable
Backport "Pass relevant git environment variables while calling `/allowed`" to 3-6-stable See merge request !120
-rw-r--r--CHANGELOG3
-rw-r--r--VERSION2
-rw-r--r--lib/gitlab_access.rb7
-rw-r--r--lib/gitlab_net.rb5
4 files changed, 13 insertions, 4 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 0e96dc5..f3e4fe3 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+v3.6.7
+ - Send (a selection of) git environment variables while making the API call to `/allowed`, !112
+
v3.6.6
- Re-use the default logger when logging metrics data
diff --git a/VERSION b/VERSION
index 4f2c1d1..5b34131 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.6.6
+3.6.7
diff --git a/lib/gitlab_access.rb b/lib/gitlab_access.rb
index 04806b2..c1b30b0 100644
--- a/lib/gitlab_access.rb
+++ b/lib/gitlab_access.rb
@@ -21,7 +21,12 @@ class GitlabAccess
end
def exec
- status = api.check_access('git-receive-pack', @repo_name, @actor, @changes, @protocol)
+ env = {
+ "GIT_ALTERNATE_OBJECT_DIRECTORIES" => ENV["GIT_ALTERNATE_OBJECT_DIRECTORIES"],
+ "GIT_OBJECT_DIRECTORY" => ENV["GIT_OBJECT_DIRECTORY"]
+ }
+
+ status = api.check_access('git-receive-pack', @repo_name, @actor, @changes, @protocol, env: env.to_json)
raise AccessDeniedError, status.message unless status.allowed?
diff --git a/lib/gitlab_net.rb b/lib/gitlab_net.rb
index 994f8d5..30fe5c4 100644
--- a/lib/gitlab_net.rb
+++ b/lib/gitlab_net.rb
@@ -15,14 +15,15 @@ class GitlabNet
CHECK_TIMEOUT = 5
READ_TIMEOUT = 300
- def check_access(cmd, repo, actor, changes, protocol)
+ def check_access(cmd, repo, actor, changes, protocol, env: {})
changes = changes.join("\n") unless changes.kind_of?(String)
params = {
action: cmd,
changes: changes,
project: project_name(repo),
- protocol: protocol
+ protocol: protocol,
+ env: env
}
if actor =~ /\Akey\-\d+\Z/