Sha256: 2d7265d88235b09f7533888b2aac7f9289882bcb20db157a6f224a1307be3023

Contents?: true

Size: 722 Bytes

Versions: 10

Compression:

Stored size: 722 Bytes

Contents

module Immunio
  module CsrfHook
    extend ActiveSupport::Concern

    included do
      alias_method_chain :verify_authenticity_token, :immunio if method_defined? :verify_authenticity_token
    end

    protected
      def verify_authenticity_token_with_immunio
        Request.time "plugin", "#{Module.nesting[0]}::#{__method__}" do
          Immunio.logger.debug "ActiveSupport checking CSRF token"

          Immunio.run_hook! "csrf", "framework_csrf_check", valid: verified_request?

          Request.pause "plugin", "#{Module.nesting[0]}::#{__method__}" do
            verify_authenticity_token_without_immunio
          end
        end
      end
  end
end

ActionController::Base.send :include, Immunio::CsrfHook

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
immunio-1.0.4 lib/immunio/plugins/csrf.rb
immunio-1.0.3 lib/immunio/plugins/csrf.rb
immunio-1.0.2 lib/immunio/plugins/csrf.rb
immunio-1.0.1 lib/immunio/plugins/csrf.rb
immunio-1.0.0 lib/immunio/plugins/csrf.rb
immunio-0.16.1 lib/immunio/plugins/csrf.rb
immunio-0.16.0 lib/immunio/plugins/csrf.rb
immunio-0.15.4 lib/immunio/plugins/csrf.rb
immunio-0.15.3 lib/immunio/plugins/csrf.rb
immunio-0.15.2 lib/immunio/plugins/csrf.rb