Commit 34eaf32f authored by Gabriel Mazetto's avatar Gabriel Mazetto

Whitelist sidekiq route in the readonly_geo middleware

parent 744b21b5
......@@ -13,8 +13,8 @@ module Gitlab
@env = env
if disallowed_request? && Gitlab::Geo.secondary?
Rails.logger.debug('Gitlab Geo: preventing possible non readonly operation')
error_message = 'You cannot do writing operations on a secondary Gitlab Geo instance'
Rails.logger.debug('GitLab Geo: preventing possible non readonly operation')
error_message = 'You cannot do writing operations on a secondary GitLab Geo instance'
if json_request?
return [403, { 'Content-Type' => 'application/json' }, [{ 'message' => error_message }.to_json]]
......@@ -60,12 +60,16 @@ module Gitlab
end
def whitelisted_routes
logout_route || WHITELISTED.any? { |path| @request.path.include?(path) }
logout_route || WHITELISTED.any? { |path| @request.path.include?(path) } || sidekiq_route
end
def logout_route
route_hash[:controller] == 'sessions' && route_hash[:action] == 'destroy'
end
def sidekiq_route
@request.path.start_with?('/admin/sidekiq')
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment