Created
November 23, 2015 17:17
-
-
Save jhollinger/c41011417f729ffe5c5c to your computer and use it in GitHub Desktop.
Fix for Sidkiq::Web's lack of CSRF token
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'securerandom' | |
module Sidekiq | |
class CsrfTokenFix | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
request = Rack::Request.new(env) | |
request.session[:csrf] ||= SecureRandom.base64(32) | |
@app.call(env) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment