breach-mitigation-rails 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/breach_mitigation/length_hiding.rb +2 -2
- data/lib/breach_mitigation/railtie.rb +7 -5
- data/lib/breach_mitigation/version.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 552f77a2f8db017504d2357a189bc0c9a154a34e
|
4
|
+
data.tar.gz: fcb86ce3d3637b5a4aa9a8848ff3e147be1cc80f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb939e4c02545bb55de00335ebe857d946eb8f3b231df5b50f5a413c5b0ffaeaf0cc287cac45d673557c0ea78f8fe77d6b3e42a34e246aec4b486f24209d672c
|
7
|
+
data.tar.gz: e1763744407fc1ac94f04e5b834c665e55c0af7f0749cab91dc5dd9db55420e16a98b0088b2753a5d7f2e2b727e741215508e98844cf31986e434befe746c427
|
data/README.md
CHANGED
@@ -9,8 +9,8 @@ module BreachMitigation
|
|
9
9
|
def call(env)
|
10
10
|
status, headers, body = @app.call(env)
|
11
11
|
|
12
|
-
# Only pad HTML documents
|
13
|
-
if headers['Content-Type'] =~ /text\/html/ && env['rack.url_scheme'] == 'https'
|
12
|
+
# Only pad HTML/XHTML documents
|
13
|
+
if headers['Content-Type'] =~ /text\/x?html/ && env['rack.url_scheme'] == 'https'
|
14
14
|
# Copy the existing response to a new object
|
15
15
|
response = Rack::Response.new(body, status, headers)
|
16
16
|
|
@@ -1,13 +1,15 @@
|
|
1
|
-
require 'breach_mitigation/length_hiding'
|
2
1
|
require 'breach_mitigation/masking_secrets'
|
3
2
|
|
4
3
|
module BreachMitigation
|
5
4
|
class Railtie < Rails::Railtie
|
6
5
|
initializer "breach-mitigation-rails.insert_middleware" do |app|
|
7
|
-
if
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
if !app.config.respond_to?(:exclude_breach_length_hiding) || !app.config.exclude_breach_length_hiding
|
7
|
+
require 'breach_mitigation/length_hiding'
|
8
|
+
if Rails.version.include?("3.0.")
|
9
|
+
app.config.middleware.use "BreachMitigation::LengthHiding"
|
10
|
+
else
|
11
|
+
app.config.middleware.insert_before "Rack::ETag", "BreachMitigation::LengthHiding"
|
12
|
+
end
|
11
13
|
end
|
12
14
|
end
|
13
15
|
end
|
data/spec/spec_helper.rb
CHANGED