Fix hashtag column options styling (#14247)
* Enable nonces for stylesheets * Pass nonce to react-select
This commit is contained in:
parent
c3187411c2
commit
a783bdf4ad
3 changed files with 34 additions and 12 deletions
|
@ -47,7 +47,25 @@ end
|
|||
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
|
||||
# Rails.application.config.content_security_policy_report_only = true
|
||||
|
||||
Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
|
||||
|
||||
# Monkey-patching Rails 5
|
||||
module ActionDispatch
|
||||
class ContentSecurityPolicy
|
||||
def nonce_directive?(directive)
|
||||
directive == 'style-src'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Rails 6 would require the following instead:
|
||||
# Rails.application.config.content_security_policy_nonce_directives = %w(style-src)
|
||||
|
||||
PgHero::HomeController.content_security_policy do |p|
|
||||
p.script_src :self, :unsafe_inline, assets_host
|
||||
p.style_src :self, :unsafe_inline, assets_host
|
||||
end
|
||||
|
||||
PgHero::HomeController.after_action do
|
||||
request.content_security_policy_nonce_generator = nil
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue