You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Method conflicting content_security_policy_nonce with Rails 5.2 #392
Also in my list of middlewares, I see ActionDispatch::ContentSecurityPolicy::Middleware inserted right after SecureHeaders::Middleware, something like this:
$ bin/rails middleware
...
use SecureHeaders::Middleware
...
use ActionDispatch::ContentSecurityPolicy::Middleware
...
A very similar issue has already been addressed in #389 where the Rails defined content_security_policy_nonce was interfering with the secure_headers defined method. If I'm reading that issue correctly the method you're using in your ERB templates is actually intended as a private API (despite it's documentation) and you should swap over to the nonced_*_tag template helpers instead.
Activity
jacobbednarz commentedon May 22, 2018
Hi @phuongvu and thanks for the report!
A very similar issue has already been addressed in #389 where the Rails defined
content_security_policy_noncewas interfering with thesecure_headersdefined method. If I'm reading that issue correctly the method you're using in your ERB templates is actually intended as a private API (despite it's documentation) and you should swap over to thenonced_*_tagtemplate helpers instead.phuongvu commentedon May 22, 2018
🙏 Awesome! I got it working with
content_security_policy_script_nonceClosing this issue as it is fixed!