Permalink
Browse files

Introducing :use

  • Loading branch information...
1 parent 5154499 commit 9cf5250a99d1524b8f8d9ef9d63de43bb0c2dc96 @homakov homakov committed Jan 21, 2013
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/rack/protection.rb
View
4 lib/rack/protection.rb
@@ -20,7 +20,11 @@ module Protection
def self.new(app, options = {})
# does not include: RemoteReferrer, AuthenticityToken and FormToken
except = Array options[:except]
+ use_these = Array options[:use]
Rack::Builder.new do
+ use ::Rack::Protection::RemoteReferrer, options if use_these.include? :remote_referrer
+ use ::Rack::Protection::AuthenticityToken,options if use_these.include? :authenticity_token
+ use ::Rack::Protection::FormToken, options if use_these.include? :form_token
use ::Rack::Protection::FrameOptions, options unless except.include? :frame_options
use ::Rack::Protection::HttpOrigin, options unless except.include? :http_origin
use ::Rack::Protection::IPSpoofing, options unless except.include? :ip_spoofing

0 comments on commit 9cf5250

Please sign in to comment.