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
d7c88ee1
Commit
d7c88ee1
authored
May 08, 2018
by
James Edwards-Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Group SAML skips forgery protection in production
parent
61bbab8a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
5 deletions
+29
-5
ee/app/controllers/groups/omniauth_callbacks_controller.rb
ee/app/controllers/groups/omniauth_callbacks_controller.rb
+2
-0
ee/changelogs/unreleased/jej-group-saml-skip-forgery-protection.yml
...ogs/unreleased/jej-group-saml-skip-forgery-protection.yml
+5
-0
ee/spec/controllers/groups/omniauth_callbacks_controller_spec.rb
.../controllers/groups/omniauth_callbacks_controller_spec.rb
+10
-0
spec/support/forgery_protection.rb
spec/support/forgery_protection.rb
+12
-5
No files found.
ee/app/controllers/groups/omniauth_callbacks_controller.rb
View file @
d7c88ee1
class
Groups::OmniauthCallbacksController
<
OmniauthCallbacksController
extend
::
Gitlab
::
Utils
::
Override
skip_before_filter
:verify_authenticity_token
,
only: :group_saml
def
group_saml
@unauthenticated_group
=
Group
.
find_by_full_path
(
params
[
:group_id
])
saml_provider
=
@unauthenticated_group
.
saml_provider
...
...
ee/changelogs/unreleased/jej-group-saml-skip-forgery-protection.yml
0 → 100644
View file @
d7c88ee1
---
title
:
Group SAML skips forgery protection in production
merge_request
:
5621
author
:
type
:
fixed
ee/spec/controllers/groups/omniauth_callbacks_controller_spec.rb
View file @
d7c88ee1
...
...
@@ -2,6 +2,7 @@ require 'spec_helper'
describe
Groups
::
OmniauthCallbacksController
do
include
LoginHelpers
include
ForgeryProtection
let
(
:uid
)
{
'my-uid'
}
let
(
:user
)
{
create
(
:user
)
}
...
...
@@ -56,6 +57,15 @@ describe Groups::OmniauthCallbacksController do
it
'uses existing linked identity'
do
expect
{
post
provider
,
group_id:
group
}.
not_to
change
(
linked_accounts
,
:count
)
end
it
'skips authenticity token based forgery protection'
do
with_forgery_protection
do
post
provider
,
group_id:
group
expect
(
response
).
not_to
be_client_error
expect
(
response
).
not_to
be_server_error
end
end
end
context
'oauth already linked to another account'
do
...
...
spec/support/forgery_protection.rb
View file @
d7c88ee1
RSpec
.
configure
do
|
config
|
config
.
around
(
:each
,
:allow_forgery_protection
)
do
|
example
|
begin
module
ForgeryProtection
def
with_forgery_protection
ActionController
::
Base
.
allow_forgery_protection
=
true
example
.
call
yield
ensure
ActionController
::
Base
.
allow_forgery_protection
=
false
end
module_function
:with_forgery_protection
end
RSpec
.
configure
do
|
config
|
config
.
around
(
:each
,
:allow_forgery_protection
)
do
|
example
|
ForgeryProtection
.
with_forgery_protection
do
example
.
call
end
end
end
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