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
866f544c
Commit
866f544c
authored
Jun 04, 2019
by
James Edwards-Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid setting Gitlab::Session on sessionless requests
parent
dbcbfc26
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
0 deletions
+41
-0
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+2
-0
changelogs/unreleased/ce-jej-fix-git-http-with-sso-enforcement.yml
...s/unreleased/ce-jej-fix-git-http-with-sso-enforcement.yml
+5
-0
spec/controllers/application_controller_spec.rb
spec/controllers/application_controller_spec.rb
+34
-0
No files found.
app/controllers/application_controller.rb
View file @
866f544c
...
...
@@ -440,6 +440,8 @@ class ApplicationController < ActionController::Base
end
def
set_session_storage
(
&
block
)
return
yield
if
sessionless_user?
Gitlab
::
Session
.
with_session
(
session
,
&
block
)
end
...
...
changelogs/unreleased/ce-jej-fix-git-http-with-sso-enforcement.yml
0 → 100644
View file @
866f544c
---
title
:
Avoid setting Gitlab::Session on sessionless requests and Git HTTP
merge_request
:
29146
author
:
type
:
fixed
spec/controllers/application_controller_spec.rb
View file @
866f544c
...
...
@@ -691,4 +691,38 @@ describe ApplicationController do
end
end
end
context
'Gitlab::Session'
do
controller
(
described_class
)
do
prepend_before_action
do
authenticate_sessionless_user!
(
:rss
)
end
def
index
if
Gitlab
::
Session
.
current
head
:created
else
head
:not_found
end
end
end
it
'is set on web requests'
do
sign_in
(
user
)
get
:index
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
end
context
'with sessionless user'
do
it
'is not set'
do
personal_access_token
=
create
(
:personal_access_token
,
user:
user
)
get
:index
,
format: :atom
,
params:
{
private_token:
personal_access_token
.
token
}
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
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