FIX: Mini-profiler CSP nonce when in report-only mode (#28664)

This commit is contained in:
David Taylor
2024-09-02 10:04:47 +01:00
committed by GitHub
parent b7164f1283
commit 3fb3ef7c85

View File

@ -90,7 +90,7 @@ if defined?(Rack::MiniProfiler) && defined?(Rack::MiniProfiler::Config)
Rack::MiniProfiler.config.content_security_policy_nonce =
Proc.new do |env, headers|
if csp = headers["Content-Security-Policy"]
if csp = headers["Content-Security-Policy"] || headers["Content-Security-Policy-Report-Only"]
csp[/script-src[^;]+'nonce-([^']+)'/, 1]
end
end