Skip to content

Commit

Permalink
allow length-hiding to be disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Neal Harris committed Mar 25, 2014
1 parent 3176d47 commit 985f5e8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -40,6 +40,10 @@ And then execute:

$ bundle

The length-hiding can be disabled by doing:

Rails.application.config.exclude_breach_length_hiding = true

For most Rails apps, that should be enough, but read on for the gory
details...

Expand Down
12 changes: 7 additions & 5 deletions lib/breach_mitigation/railtie.rb
@@ -1,13 +1,15 @@
require 'breach_mitigation/length_hiding'
require 'breach_mitigation/masking_secrets'

module BreachMitigation
class Railtie < Rails::Railtie
initializer "breach-mitigation-rails.insert_middleware" do |app|
if Rails.version.include?("3.0.")
app.config.middleware.use "BreachMitigation::LengthHiding"
else
app.config.middleware.insert_before "Rack::ETag", "BreachMitigation::LengthHiding"
if !app.config.respond_to?(:exclude_breach_length_hiding) || !app.config.exclude_breach_length_hiding
require 'breach_mitigation/length_hiding'
if Rails.version.include?("3.0.")
app.config.middleware.use "BreachMitigation::LengthHiding"
else
app.config.middleware.insert_before "Rack::ETag", "BreachMitigation::LengthHiding"
end
end
end
end
Expand Down

0 comments on commit 985f5e8

Please sign in to comment.