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
3b994ba8
Commit
3b994ba8
authored
Apr 06, 2021
by
Małgorzata Ksionek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix wrong token in sso url in git message
parent
d21f12c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
ee/lib/ee/gitlab/git_access.rb
ee/lib/ee/gitlab/git_access.rb
+2
-1
ee/spec/lib/gitlab/git_access_spec.rb
ee/spec/lib/gitlab/git_access_spec.rb
+15
-1
No files found.
ee/lib/ee/gitlab/git_access.rb
View file @
3b994ba8
...
...
@@ -122,7 +122,8 @@ module EE
return
unless
::
Gitlab
::
Auth
::
GroupSaml
::
SessionEnforcer
.
new
(
user
,
containing_group
).
access_restricted?
group_saml_url
=
Rails
.
application
.
routes
.
url_helpers
.
sso_group_saml_providers_url
(
containing_group
,
token:
containing_group
.
saml_discovery_token
)
root_group
=
containing_group
.
root_ancestor
group_saml_url
=
Rails
.
application
.
routes
.
url_helpers
.
sso_group_saml_providers_url
(
root_group
,
token:
root_group
.
saml_discovery_token
)
raise
::
Gitlab
::
GitAccess
::
ForbiddenError
,
"Cannot find valid SSO session. Please login via your group's SSO at
#{
group_saml_url
}
"
end
...
...
ee/spec/lib/gitlab/git_access_spec.rb
View file @
3b994ba8
...
...
@@ -954,12 +954,26 @@ RSpec.describe Gitlab::GitAccess do
it
'does not allow pull or push changes with proper url in the message'
do
aggregate_failures
do
address
=
"http://localhost/groups/
#{
group
.
name
}
/-/saml/sso"
address
=
"http://localhost/groups/
#{
group
.
name
}
/-/saml/sso
?token=
#{
group
.
saml_discovery_token
}
"
expect
{
pull_changes
}.
to
raise_error
(
Gitlab
::
GitAccess
::
ForbiddenError
,
/
#{
Regexp
.
quote
(
address
)
}
/
)
expect
{
push_changes
}.
to
raise_error
(
Gitlab
::
GitAccess
::
ForbiddenError
,
/
#{
Regexp
.
quote
(
address
)
}
/
)
end
end
context
'with a subgroup'
do
let_it_be
(
:root_group
)
{
create
(
:group
)
}
let_it_be
(
:group
)
{
create
(
:group
,
parent:
root_group
)
}
it
'does not allow pull or push changes with proper url in the message'
do
aggregate_failures
do
address
=
"http://localhost/groups/
#{
root_group
.
name
}
/-/saml/sso?token=
#{
root_group
.
saml_discovery_token
}
"
expect
{
pull_changes
}.
to
raise_error
(
Gitlab
::
GitAccess
::
ForbiddenError
,
/
#{
Regexp
.
quote
(
address
)
}
/
)
expect
{
push_changes
}.
to
raise_error
(
Gitlab
::
GitAccess
::
ForbiddenError
,
/
#{
Regexp
.
quote
(
address
)
}
/
)
end
end
end
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