Commit a2c16b23 authored by Rémy Coutable's avatar Rémy Coutable
Browse files

Merge branch 'backport-112-to-3-6-stable' into '3-6-stable'

Backport "Pass relevant git environment variables while calling `/allowed`" to 3-6-stable

See merge request !120
Pipeline #966 failed with stage
in 0 seconds
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
......
......@@ -21,7 +21,12 @@
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?
......
......@@ -15,10 +15,10 @@
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),
......@@ -19,10 +19,11 @@
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/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment