Skip to content

Commit b102b53

Browse files
committed
add deprecation warning for directives configured with strings
1 parent f336572 commit b102b53

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/secure_headers/headers/content_security_policy.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,10 @@ def initialize(config=nil, options={})
139139
@config = config.inject({}) do |hash, (key, value)|
140140
config_val = value.respond_to?(:call) ? value.call(@controller) : value
141141
if ALL_DIRECTIVES.include?(key.to_sym) # directives need to be normalized to arrays of strings
142-
config_val = config_val.split if config_val.is_a? String
142+
if config_val.is_a? String
143+
warn "[DEPRECATION] A String was supplied for directive #{key}. secure_headers 3.x will require all directives to be arrays of strings."
144+
config_val = config_val.split
145+
end
143146
if config_val.is_a?(Array)
144147
config_val = config_val.map do |val|
145148
translate_dir_value(val)

0 commit comments

Comments
 (0)