diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-23 06:08:53 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-23 06:08:53 +0300 |
commit | ccaa94488202341c25d24f6f16a70a9f658fc742 (patch) | |
tree | 886b8d0d4c14585243f3ccb439057e19f1860767 /lib/gitlab | |
parent | d65442b1d9621da6749d59ea1a544a2ea39b3a79 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/middleware/read_only/controller.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/gitlab/middleware/read_only/controller.rb b/lib/gitlab/middleware/read_only/controller.rb index b18f0eed1fa..c749816cf6a 100644 --- a/lib/gitlab/middleware/read_only/controller.rb +++ b/lib/gitlab/middleware/read_only/controller.rb @@ -24,6 +24,10 @@ module Gitlab 'projects/compare' => %w{create} }.freeze + WHITELISTED_LOGOUT_ROUTES = { + 'sessions' => %w{destroy} + }.freeze + GRAPHQL_URL = '/api/graphql' def initialize(app, env) @@ -85,7 +89,7 @@ module Gitlab # Overridden in EE module def whitelisted_routes - grack_route? || internal_route? || lfs_route? || compare_git_revisions_route? || sidekiq_route? || graphql_query? + grack_route? || internal_route? || lfs_route? || compare_git_revisions_route? || sidekiq_route? || logout_route? || graphql_query? end def grack_route? @@ -118,6 +122,13 @@ module Gitlab WHITELISTED_GIT_LFS_ROUTES[route_hash[:controller]]&.include?(route_hash[:action]) end + def logout_route? + # Calling route_hash may be expensive. Only do it if we think there's a possible match + return false unless request.post? && request.path.end_with?('/users/sign_out') + + WHITELISTED_LOGOUT_ROUTES[route_hash[:controller]]&.include?(route_hash[:action]) + end + def sidekiq_route? request.path.start_with?("#{relative_url}/admin/sidekiq") end |