Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Set existing nonce-key, but call super to use secure-headers code

Oliver Günthere7392383c9c2
diff --git a/lib/open_project/patches/secure_headers_turbo_aware_nonce.rb b/lib/open_project/patches/secure_headers_turbo_aware_nonce.rb
index 4090fe089b2..5ee08bbd674 100644
--- a/lib/open_project/patches/secure_headers_turbo_aware_nonce.rb
+++ b/lib/open_project/patches/secure_headers_turbo_aware_nonce.rb
@@ -30,10 +30,10 @@
module OpenProject::Patches::SecureHeadersTurboAwareNonce
def content_security_policy_script_nonce(request)
if request.env["HTTP_TURBO_REFERRER"].present?
- request.env["HTTP_X_TURBO_NONCE"]
- else
- super
+ request.env[SecureHeaders::NONCE_KEY] ||= request.env["HTTP_X_TURBO_NONCE"]
end
+
+ super
end
end