新手问题 Rails 环境搭建,提示安全警告

Guest · 发布于 2013年01月08日 · 最后由 lnliuxu 回复于 2015年05月31日 · 3763 次阅读
5154

照着教程搭建了Rails的环境,能够正常运行,但是会但一个警告,如下: SECURITY WARNING: No secret option provided to Rack::Session::Cookie. This poses a security threat. It is strongly recommended that you provide a secret to prevent exploits that may be possible from crafted cookies. This will not be supported in future versions of Rack, and future versions will even invalidate your existing user cookies.

Called from: /home/soledad/.rvm/gems/ruby-1.9.3-p362/gems/actionpack-3.2.10/lib/action_dispatch/middleware/session/abstract_store.rb:28:in `initialize'.

服务器是正常允许的,rails是3.2.10版本,想请教一下,是不是配置有些什么问题?

共收到 4 条回复
Eda824

stackoverflow已经有讨论,无需修正,或者硬要修的话,修改/home/soledad/.rvm/gems/ruby-1.9.3-p327/gems/actionpack-3.2.10/lib/action_dispatch/middleware/session目录下的abstract_store.rb,插一行即可:

module Compatibility
  def initialize(app, options = {})
    options[:key] ||= '_session_id'
    options[:secret] ||= Rails.application.config.secret_token # insert this line, only a temp solution
    super
  end
5154

非常感谢

9484

正好遇到这个问题,收下了,哈哈

96

才遇到 。。。惭愧啊 新手

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册