Skip to content

Commit f336572

Browse files
committed
add deprecation warnings for headers that will no longer accept a hash for config
1 parent 40fa4a5 commit f336572

File tree

8 files changed

+10
-0
lines changed

8 files changed

+10
-0
lines changed

lib/secure_headers/headers/strict_transport_security.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def value
4141

4242
def validate_config
4343
if @config.is_a? Hash
44+
warn "[DEPRECATION] secure_headers 3.0 will only accept string values for StrictTransportSecurity config"
4445
if !@config[:max_age]
4546
raise STSBuildError.new("No max-age was supplied.")
4647
elsif @config[:max_age].to_s !~ /\A\d+\z/

lib/secure_headers/headers/x_content_type_options.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def value
2525
when String
2626
@config
2727
else
28+
warn "[DEPRECATION] secure_headers 3.0 will only accept string values for XContentTypeOptions config"
2829
@config[:value]
2930
end
3031
end

lib/secure_headers/headers/x_download_options.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def value
2424
when String
2525
@config
2626
else
27+
warn "[DEPRECATION] secure_headers 3.0 will only accept string values for XDownloadOptions config"
2728
@config[:value]
2829
end
2930
end

lib/secure_headers/headers/x_frame_options.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def value
2525
when String
2626
@config
2727
else
28+
warn "[DEPRECATION] secure_headers 3.0 will only accept string values for XFrameOptions config"
2829
@config[:value]
2930
end
3031
end

lib/secure_headers/headers/x_permitted_cross_domain_policies.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def value
2525
when String
2626
@config
2727
else
28+
warn "[DEPRECATION] secure_headers 3.0 will only accept string values for XPermittedCrossDomainPolicies config"
2829
@config[:value]
2930
end
3031
end

lib/secure_headers/headers/x_xss_protection.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def value
2525
when String
2626
@config
2727
else
28+
warn "[DEPRECATION] secure_headers 3.0 will only accept string values for XXssProtection config"
2829
value = @config[:value].to_s
2930
value += "; mode=#{@config[:mode]}" if @config[:mode]
3031
value += "; report=#{@config[:report_uri]}" if @config[:report_uri]

spec/lib/secure_headers/headers/x_content_type_options_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require 'spec_helper'
2+
13
module SecureHeaders
24
describe XContentTypeOptions do
35
specify{ expect(XContentTypeOptions.new.name).to eq("X-Content-Type-Options") }

spec/lib/secure_headers/headers/x_xss_protection_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require 'spec_helper'
2+
13
module SecureHeaders
24
describe XXssProtection do
35
specify { expect(XXssProtection.new.name).to eq(X_XSS_PROTECTION_HEADER_NAME)}

0 commit comments

Comments
 (0)