-
-
Notifications
You must be signed in to change notification settings - Fork 873
Description
I am unable to use add_header for adding a Content-Security-Policy header to a server. Because the CSP syntax uses single-quotes explicitly (https://content-security-policy.com/) for certain terms, the single-quotes that are being used to wrap the header value (added in #804) cause the nginx syntax to break.
Passing { "Content-Security-Policy" : "default-src 'self';" }
into the $add_header parameter of nginx::resource::server will result in the configuration add_header 'Content-Security-Policy' 'default-src 'self';'
, which is invalid. I tried using double-quotes in the CSP header as a workaround, but it breaks on certain keywords in the browser. You can use the raw_prepend option as a workaround, but a more elegant solution would be nice.
This could be fixed by either
- changing to double-quotes in the template when applying the add_header values
- allowing users to supply their own quotes
- something else ?