Q: How can I change the meta tags name of 'csrf-param' and 'csrf-token' in Rails 4? As the title states, I wonder how I can change the meta tags name of csrf-param and csrf-token?
<meta content="authenticity_token" name="csrf-param" />
<meta content="123456" name="csrf-token" />

I'm asking this, because for safety reason I want to hide, which technology I'm using to power my website. The Chrome plugin Wappalyzer uses this meta tags as indicators for Ruby on Rails.


A: Create an initializer called change_csrf_name.rb
inside this file you can change the :name => 'xyz'. beware that it might break some built in functionality you were not expecting.
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

