Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
3959953c
Commit
3959953c
authored
Feb 25, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
411b58e0
dbf0a922
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
1 deletion
+15
-1
changelogs/unreleased/sh-fix-issue-58103.yml
changelogs/unreleased/sh-fix-issue-58103.yml
+5
-0
lib/api/helpers/runner.rb
lib/api/helpers/runner.rb
+1
-1
spec/requests/api/runner_spec.rb
spec/requests/api/runner_spec.rb
+9
-0
No files found.
changelogs/unreleased/sh-fix-issue-58103.yml
0 → 100644
View file @
3959953c
---
title
:
Properly handle multiple X-Forwarded-For addresses in runner IP
merge_request
:
25511
author
:
type
:
fixed
lib/api/helpers/runner.rb
View file @
3959953c
...
...
@@ -28,7 +28,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
...
...
spec/requests/api/runner_spec.rb
View file @
3959953c
...
...
@@ -526,6 +526,15 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
expect
(
runner
.
reload
.
ip_address
).
to
eq
(
'123.222.123.222'
)
end
it
"handles multiple X-Forwarded-For addresses"
do
post
api
(
'/jobs/request'
),
params:
{
token:
runner
.
token
},
headers:
{
'User-Agent'
=>
user_agent
,
'X-Forwarded-For'
=>
'123.222.123.222, 127.0.0.1'
}
expect
(
response
).
to
have_gitlab_http_status
201
expect
(
runner
.
reload
.
ip_address
).
to
eq
(
'123.222.123.222'
)
end
context
'when concurrently updating a job'
do
before
do
expect_any_instance_of
(
Ci
::
Build
).
to
receive
(
:run!
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment