Sha256: fdbc484b9d1c9e6106d6eb8fe7c443c58f8cda3e747509069244dd649f110982

Contents?: true

Size: 594 Bytes

Versions: 27

Compression:

Stored size: 594 Bytes

Contents

require 'rack/protection'

module Rack
  module Protection
    ##
    # Prevented attack::   CSRF
    # Supported browsers:: all
    # More infos::         http://en.wikipedia.org/wiki/Cross-site_request_forgery
    #
    # Only accepts unsafe HTTP requests if a given access token matches the token
    # included in the session *or* the request comes from the same origin.
    #
    # Compatible with rack-csrf.
    class RemoteToken < AuthenticityToken
      default_reaction :deny

      def accepts?(env)
        super or referrer(env) == Request.new(env).host
      end
    end
  end
end

Version data entries

27 entries across 24 versions & 4 rubygems

Version Path
rack-protection-2.2.4 lib/rack/protection/remote_token.rb
rack-protection-2.2.3 lib/rack/protection/remote_token.rb
rack-protection-2.2.2 lib/rack/protection/remote_token.rb
rack-protection-2.2.1 lib/rack/protection/remote_token.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.2.0/lib/rack/protection/remote_token.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/remote_token.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/3.0.0/gems/rack-protection-2.1.0/lib/rack/protection/remote_token.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/3.1.0/gems/rack-protection-2.1.0/lib/rack/protection/remote_token.rb
rack-protection-2.2.0 lib/rack/protection/remote_token.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/rack-protection-2.1.0/lib/rack/protection/remote_token.rb
rack-protection-2.1.0 lib/rack/protection/remote_token.rb
rack-protection-2.0.8.1 lib/rack/protection/remote_token.rb
rack-protection-2.0.8 lib/rack/protection/remote_token.rb
rack-protection-2.0.7 lib/rack/protection/remote_token.rb
rack-protection-2.0.6 lib/rack/protection/remote_token.rb
rack-protection-2.0.5 lib/rack/protection/remote_token.rb
rack-protection-2.0.4 lib/rack/protection/remote_token.rb
rack-protection-2.0.3 lib/rack/protection/remote_token.rb
rack-protection-2.0.2 lib/rack/protection/remote_token.rb
rack-protection-2.0.1 lib/rack/protection/remote_token.rb