mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Don't enable CSRF if sessions are disabled
This commit is contained in:
parent
eb2a6ab497
commit
3e26e06d06
1 changed files with 4 additions and 3 deletions
|
@ -155,12 +155,13 @@ module Sidekiq
|
|||
def build_sessions
|
||||
middlewares = self.middlewares
|
||||
|
||||
unless using?(CsrfProtection) || ENV["RACK_ENV"] == "test"
|
||||
s = sessions
|
||||
|
||||
# turn on CSRF protection if sessions are enabled and this is not the test env
|
||||
if s && !using?(CsrfProtection) && ENV["RACK_ENV"] != "test"
|
||||
middlewares.unshift [[CsrfProtection], nil]
|
||||
end
|
||||
|
||||
s = sessions
|
||||
|
||||
if s && !using?(::Rack::Session::Cookie)
|
||||
unless (secret = Web.session_secret)
|
||||
require "securerandom"
|
||||
|
|
Loading…
Add table
Reference in a new issue