@@ -137,9 +137,18 @@ def initialize(config=nil, options={})
137137
138138 # Config values can be string, array, or lamdba values
139139 @config = config . inject ( { } ) do |hash , ( key , value ) |
140- config_val = value . respond_to? ( :call ) ? value . call ( @controller ) : value
140+ config_val = if value . respond_to? ( :call )
141+ warn "[DEPRECATION] secure_headers 3.x will not support procs as config values."
142+ value . call ( @controller )
143+ else
144+ value
145+ end
146+
141147 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
148+ if config_val . is_a? String
149+ warn "[DEPRECATION] A String was supplied for directive #{ key } . secure_headers 3.x will require all directives to be arrays of strings."
150+ config_val = config_val . split
151+ end
143152 if config_val . is_a? ( Array )
144153 config_val = config_val . map do |val |
145154 translate_dir_value ( val )
@@ -258,10 +267,10 @@ def append_http_additions
258267
259268 def translate_dir_value val
260269 if %w{ inline eval } . include? ( val )
261- warn "[DEPRECATION] using inline/eval may not be supported in the future . Instead use 'unsafe-inline'/'unsafe-eval' instead."
270+ warn "[DEPRECATION] using inline/eval is not suppored in secure_headers 3.x . Instead use 'unsafe-inline'/'unsafe-eval' instead."
262271 val == 'inline' ? "'unsafe-inline'" : "'unsafe-eval'"
263272 elsif %{self none} . include? ( val )
264- warn "[DEPRECATION] using self/none may not be supported in the future . Instead use 'self'/'none' instead."
273+ warn "[DEPRECATION] using self/none is not suppored in secure_headers 3.x . Instead use 'self'/'none' instead."
265274 "'#{ val } '"
266275 elsif val == 'nonce'
267276 if supports_nonces?
0 commit comments