No secret option provided to Rack::Session::Cookie warning?

前端 未结 7 1519
长发绾君心
长发绾君心 2020-11-27 14:52

I am running Rails 3.2.3, Ruby 1.9 under Fedora 17. I get this warning, when I run rails s, and how do I fix?

SECURITY WARNING: No secre

7条回答
  •  自闭症患者
    2020-11-27 15:33

    rails 3.2.9 - ruby 1.9.3p125 (2012-02-16 revision 34643) [i686-linux]

    Hello everyone, the following has worked for me, it may work for you.


    /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.2.9/lib/action_dispatch/middleware/session/abstract_store.rb
    module Compatibility
              def initialize(app, options = {})
                options[:key]     ||= '_session_id'
                #fixed warning - SECURITY WARNING: No secret option provided to Rack::Session::Cookie.
                options[:secret] ||= Rails.application.config.secret_token
                super
              end
        end
    

提交回复
热议问题