Skip to content

Commit

Permalink
Merge pull request #142 from twitter/more_constants
Browse files Browse the repository at this point in the history
Add :report_uri to list of directives
  • Loading branch information
oreoshake committed May 5, 2015
2 parents 9ca6e0c + f5dcfb8 commit a6041d2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/secure_headers/headers/content_security_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ module Constants
:reflected_xss
]

ALL_DIRECTIVES = DIRECTIVES + NON_DEFAULT_SOURCES
OTHER = [
:report_uri
]

SOURCE_DIRECTIVES = DIRECTIVES + NON_DEFAULT_SOURCES

ALL_DIRECTIVES = DIRECTIVES + NON_DEFAULT_SOURCES + OTHER
end
include Constants

Expand Down Expand Up @@ -102,7 +108,7 @@ def initialize(config=nil, options={})
@config = config.inject({}) do |hash, (key, value)|
config_val = value.respond_to?(:call) ? value.call : value

if ALL_DIRECTIVES.include?(key) # directives need to be normalized to arrays of strings
if SOURCE_DIRECTIVES.include?(key) # directives need to be normalized to arrays of strings
config_val = config_val.split if config_val.is_a? String
if config_val.is_a?(Array)
config_val = config_val.map do |val|
Expand Down

0 comments on commit a6041d2

Please sign in to comment.