Rob*_*bin 6 ruby-on-rails csrf ruby-on-rails-4
正如标题所述,我想知道如何更改meta标签的名称csrf-param和csrf-token?
<meta content="authenticity_token" name="csrf-param" />
<meta content="123456" name="csrf-token" />
Run Code Online (Sandbox Code Playgroud)
我问这个问题,因为出于安全原因我想隐藏,我正在使用哪种技术来支持我的网站.Chrome插件Wappalyzer使用此元标记作为指标Ruby on Rails.

创建一个名为的初始化程序change_csrf_name.rb
在此文件中,您可以更改:name => 'xyz'. 请注意,它可能会破坏一些您意想不到的内置功能。
module ActionView
module Helpers
module CsrfHelper
def csrf_meta_tags
if protect_against_forgery?
[
tag('meta', :name => 'csrf-param', :content => request_forgery_protection_token),
tag('meta', :name => 'csrf-token', :content => form_authenticity_token)
].join("\n").html_safe
end
end
end
end
end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1015 次 |
| 最近记录: |