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
c6ed8073
Commit
c6ed8073
authored
Sep 12, 2019
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a feature flag for redirecting unknown-format requests
parent
675fe4fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
lib/gitlab/devise_failure.rb
lib/gitlab/devise_failure.rb
+2
-0
spec/controllers/application_controller_spec.rb
spec/controllers/application_controller_spec.rb
+13
-3
No files found.
lib/gitlab/devise_failure.rb
View file @
c6ed8073
...
...
@@ -5,6 +5,8 @@ module Gitlab
# If the request format is not known, send a redirect instead of a 401
# response, since this is the outcome we're most likely to want
def
http_auth?
return
super
unless
Feature
.
enabled?
(
:devise_redirect_unknown_formats
,
default_enabled:
true
)
request_format
&&
super
end
end
...
...
spec/controllers/application_controller_spec.rb
View file @
c6ed8073
...
...
@@ -191,10 +191,20 @@ describe ApplicationController do
expect
(
response
).
to
redirect_to
new_user_session_path
end
it
'redirects if unauthenticated and request format is unknown'
do
get
:index
,
format:
'unknown'
context
'request format is unknown'
do
it
'redirects if unauthenticated'
do
get
:index
,
format:
'unknown'
expect
(
response
).
to
redirect_to
new_user_session_path
expect
(
response
).
to
redirect_to
new_user_session_path
end
it
'returns a 401 if the feature flag is disabled'
do
stub_feature_flags
(
devise_redirect_unknown_formats:
false
)
get
:index
,
format:
'unknown'
expect
(
response
).
to
have_gitlab_http_status
(
401
)
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