BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
5f818983
Commit
5f818983
authored
Apr 05, 2017
by
Sean McGivern
Committed by
DJ Mountney
Apr 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'open-redirect-host-fix' into 'security'
Fix for three open redirect vulns using redirect_to url_for(params.merge))) See merge request !2082
parent
536a25f0
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
3 deletions
+37
-3
todos_controller.rb
app/controllers/dashboard/todos_controller.rb
+1
-1
issues_controller.rb
app/controllers/projects/issues_controller.rb
+1
-1
merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+1
-1
open-redirect-host-field.yml
changelogs/unreleased/open-redirect-host-field.yml
+4
-0
todos_controller_spec.rb
spec/controllers/dashboard/todos_controller_spec.rb
+7
-0
issues_controller_spec.rb
spec/controllers/projects/issues_controller_spec.rb
+11
-0
merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+12
-0
No files found.
app/controllers/dashboard/todos_controller.rb
View file @
5f818983
...
@@ -7,7 +7,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController
...
@@ -7,7 +7,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController
@sort
=
params
[
:sort
]
@sort
=
params
[
:sort
]
@todos
=
@todos
.
page
(
params
[
:page
])
@todos
=
@todos
.
page
(
params
[
:page
])
if
@todos
.
out_of_range?
&&
@todos
.
total_pages
!=
0
if
@todos
.
out_of_range?
&&
@todos
.
total_pages
!=
0
redirect_to
url_for
(
params
.
merge
(
page:
@todos
.
total_pages
))
redirect_to
url_for
(
params
.
merge
(
page:
@todos
.
total_pages
,
only_path:
true
))
end
end
end
end
...
...
app/controllers/projects/issues_controller.rb
View file @
5f818983
...
@@ -29,7 +29,7 @@ class Projects::IssuesController < Projects::ApplicationController
...
@@ -29,7 +29,7 @@ class Projects::IssuesController < Projects::ApplicationController
@issuable_meta_data
=
issuable_meta_data
(
@issues
,
@collection_type
)
@issuable_meta_data
=
issuable_meta_data
(
@issues
,
@collection_type
)
if
@issues
.
out_of_range?
&&
@issues
.
total_pages
!=
0
if
@issues
.
out_of_range?
&&
@issues
.
total_pages
!=
0
return
redirect_to
url_for
(
params
.
merge
(
page:
@issues
.
total_pages
))
return
redirect_to
url_for
(
params
.
merge
(
page:
@issues
.
total_pages
,
only_path:
true
))
end
end
if
params
[
:label_name
].
present?
if
params
[
:label_name
].
present?
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
5f818983
...
@@ -42,7 +42,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -42,7 +42,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@issuable_meta_data
=
issuable_meta_data
(
@merge_requests
,
@collection_type
)
@issuable_meta_data
=
issuable_meta_data
(
@merge_requests
,
@collection_type
)
if
@merge_requests
.
out_of_range?
&&
@merge_requests
.
total_pages
!=
0
if
@merge_requests
.
out_of_range?
&&
@merge_requests
.
total_pages
!=
0
return
redirect_to
url_for
(
params
.
merge
(
page:
@merge_requests
.
total_pages
))
return
redirect_to
url_for
(
params
.
merge
(
page:
@merge_requests
.
total_pages
,
only_path:
true
))
end
end
if
params
[
:label_name
].
present?
if
params
[
:label_name
].
present?
...
...
changelogs/unreleased/open-redirect-host-field.yml
0 → 100644
View file @
5f818983
---
title
:
Fix for open redirect vulnerabilities in todos, issues, and MR controllers.
merge_request
:
author
:
spec/controllers/dashboard/todos_controller_spec.rb
View file @
5f818983
...
@@ -35,6 +35,13 @@ describe Dashboard::TodosController do
...
@@ -35,6 +35,13 @@ describe Dashboard::TodosController do
expect
(
assigns
(
:todos
).
current_page
).
to
eq
(
last_page
)
expect
(
assigns
(
:todos
).
current_page
).
to
eq
(
last_page
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
end
end
it
'does not redirect to external sites when provided a host field'
do
external_host
=
"www.example.com"
get
:index
,
page:
(
last_page
+
1
).
to_param
,
host:
external_host
expect
(
response
).
to
redirect_to
(
dashboard_todos_path
(
page:
last_page
))
end
end
end
end
end
...
...
spec/controllers/projects/issues_controller_spec.rb
View file @
5f818983
...
@@ -83,6 +83,17 @@ describe Projects::IssuesController do
...
@@ -83,6 +83,17 @@ describe Projects::IssuesController do
expect
(
assigns
(
:issues
).
current_page
).
to
eq
(
last_page
)
expect
(
assigns
(
:issues
).
current_page
).
to
eq
(
last_page
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
end
end
it
'does not redirect to external sites when provided a host field'
do
external_host
=
"www.example.com"
get
:index
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
page:
(
last_page
+
1
).
to_param
,
host:
external_host
expect
(
response
).
to
redirect_to
(
namespace_project_issues_path
(
page:
last_page
,
state:
controller
.
params
[
:state
],
scope:
controller
.
params
[
:scope
]))
end
end
end
end
end
...
...
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
5f818983
...
@@ -176,6 +176,18 @@ describe Projects::MergeRequestsController do
...
@@ -176,6 +176,18 @@ describe Projects::MergeRequestsController do
expect
(
assigns
(
:merge_requests
).
current_page
).
to
eq
(
last_page
)
expect
(
assigns
(
:merge_requests
).
current_page
).
to
eq
(
last_page
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
end
end
it
'does not redirect to external sites when provided a host field'
do
external_host
=
"www.example.com"
get
:index
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
state:
'opened'
,
page:
(
last_page
+
1
).
to_param
,
host:
external_host
expect
(
response
).
to
redirect_to
(
namespace_project_merge_requests_path
(
page:
last_page
,
state:
controller
.
params
[
:state
],
scope:
controller
.
params
[
:scope
]))
end
end
end
context
'when filtering by opened state'
do
context
'when filtering by opened state'
do
...
...
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