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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Fix dynamic setting of policy to avoid leaking into new request
Oliver Günthera39a2a67b2b6
diff --git a/app/controllers/concerns/dynamic_content_security_policy.rb b/app/controllers/concerns/dynamic_content_security_policy.rbindex 4d9e015a0c9..440a38869de 100644--- a/app/controllers/concerns/dynamic_content_security_policy.rb+++ b/app/controllers/concerns/dynamic_content_security_policy.rb@@ -33,9 +33,9 @@ module DynamicContentSecurityPolicy# Dynamically append sources to CSP directives# This replaces the secure_headers named append functionalitydef append_content_security_policy_directives(directives)- current_policy = current_content_security_policy+ policy = current_content_security_policydirectives.each do |directive, source_values|- current_value = current_policy.send(directive) || current_policy.default_src+ current_value = policy.send(directive) || policy.directives["default-src"]new_values =if current_value == %w('none') # rubocop:disable Lint/PercentStringArraysource_values.compact.uniq@@ -43,7 +43,8 @@ module DynamicContentSecurityPolicy(current_value + source_values).compact.uniqend- request.content_security_policy.send(directive, *new_values)+ policy.send(directive, *new_values)+ request.content_security_policy = policyendendend