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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
2408519e
Commit
2408519e
authored
Jun 21, 2018
by
Francisco Javier López
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changing the hook test action to use POST
parent
65f27de7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
5 deletions
+10
-5
app/helpers/hooks_helper.rb
app/helpers/hooks_helper.rb
+1
-1
changelogs/unreleased/security-fj-missing-csrf-system-hooks.yml
...logs/unreleased/security-fj-missing-csrf-system-hooks.yml
+5
-0
config/routes/admin.rb
config/routes/admin.rb
+1
-1
config/routes/project.rb
config/routes/project.rb
+1
-1
spec/routing/admin_routing_spec.rb
spec/routing/admin_routing_spec.rb
+1
-1
spec/routing/project_routing_spec.rb
spec/routing/project_routing_spec.rb
+1
-1
No files found.
app/helpers/hooks_helper.rb
View file @
2408519e
...
...
@@ -10,7 +10,7 @@ module HooksHelper
trigger_human_name
=
trigger
.
to_s
.
tr
(
'_'
,
' '
).
camelize
link_to
path
,
rel:
'nofollow'
do
link_to
path
,
rel:
'nofollow'
,
method: :post
do
content_tag
(
:span
,
trigger_human_name
)
end
end
...
...
changelogs/unreleased/security-fj-missing-csrf-system-hooks.yml
0 → 100644
View file @
2408519e
---
title
:
Adding CSRF protection to Hooks test action
merge_request
:
author
:
type
:
security
config/routes/admin.rb
View file @
2408519e
...
...
@@ -54,7 +54,7 @@ namespace :admin do
resources
:hooks
,
only:
[
:index
,
:create
,
:edit
,
:update
,
:destroy
]
do
member
do
ge
t
:test
pos
t
:test
end
resources
:hook_logs
,
only:
[
:show
]
do
...
...
config/routes/project.rb
View file @
2408519e
...
...
@@ -301,7 +301,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
resources
:hooks
,
only:
[
:index
,
:create
,
:edit
,
:update
,
:destroy
],
constraints:
{
id:
/\d+/
}
do
member
do
ge
t
:test
pos
t
:test
end
resources
:hook_logs
,
only:
[
:show
]
do
...
...
spec/routing/admin_routing_spec.rb
View file @
2408519e
...
...
@@ -79,7 +79,7 @@ end
# edit_admin_hook GET /admin/hooks/:id(.:format) admin/hooks#edit
describe
Admin
::
HooksController
,
"routing"
do
it
"to #test"
do
expect
(
ge
t
(
"/admin/hooks/1/test"
)).
to
route_to
(
'admin/hooks#test'
,
id:
'1'
)
expect
(
pos
t
(
"/admin/hooks/1/test"
)).
to
route_to
(
'admin/hooks#test'
,
id:
'1'
)
end
it
"to #index"
do
...
...
spec/routing/project_routing_spec.rb
View file @
2408519e
...
...
@@ -389,7 +389,7 @@ describe 'project routing' do
# DELETE /:project_id/hooks/:id(.:format) hooks#destroy
describe
Projects
::
HooksController
,
'routing'
do
it
'to #test'
do
expect
(
ge
t
(
'/gitlab/gitlabhq/hooks/1/test'
)).
to
route_to
(
'projects/hooks#test'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'1'
)
expect
(
pos
t
(
'/gitlab/gitlabhq/hooks/1/test'
)).
to
route_to
(
'projects/hooks#test'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'1'
)
end
it_behaves_like
'RESTful project resources'
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