Skip to content

Commit a6041d2

Browse files
committed
Merge pull request #142 from twitter/more_constants
Add :report_uri to list of directives
2 parents 9ca6e0c + f5dcfb8 commit a6041d2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/secure_headers/headers/content_security_policy.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ module Constants
3131
:reflected_xss
3232
]
3333

34-
ALL_DIRECTIVES = DIRECTIVES + NON_DEFAULT_SOURCES
34+
OTHER = [
35+
:report_uri
36+
]
37+
38+
SOURCE_DIRECTIVES = DIRECTIVES + NON_DEFAULT_SOURCES
39+
40+
ALL_DIRECTIVES = DIRECTIVES + NON_DEFAULT_SOURCES + OTHER
3541
end
3642
include Constants
3743

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

105-
if ALL_DIRECTIVES.include?(key) # directives need to be normalized to arrays of strings
111+
if SOURCE_DIRECTIVES.include?(key) # directives need to be normalized to arrays of strings
106112
config_val = config_val.split if config_val.is_a? String
107113
if config_val.is_a?(Array)
108114
config_val = config_val.map do |val|

0 commit comments

Comments
 (0)