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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-02-24 19:45:00 +0300
committerStan Hu <stanhu@gmail.com>2019-02-25 01:50:55 +0300
commitd03b7bb1e024dcbf68b523686751d3a2025ed03c (patch)
tree99e1dfd73374db247a74a11d4c5cc83f07ed2279 /lib
parentc44c83c447377f974e1d3f9b7719cd115791fbb1 (diff)
Properly handle multiple X-Forwarded-For addresses in runner IP
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24624 extracted the X-Forwarded-For address directly, but this didn't consider the case where multiple proxies are in the chain. To fix this, we use the Rails implementation to filter trusted proxies, as documented by Grape: https://github.com/ruby-grape/grape#remote-ip Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/58103
Diffstat (limited to 'lib')
-rw-r--r--lib/api/helpers/runner.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/api/helpers/runner.rb b/lib/api/helpers/runner.rb
index 16df8e830e1..ff73a49d5e8 100644
--- a/lib/api/helpers/runner.rb
+++ b/lib/api/helpers/runner.rb
@@ -26,7 +26,7 @@ module API
end
def get_runner_ip
- { ip_address: request.env["HTTP_X_FORWARDED_FOR"] || request.ip }
+ { ip_address: env["action_dispatch.remote_ip"].to_s || request.ip }
end
def current_runner