]> source.dussan.org Git - redmine.git/commitdiff
Set a strict CSP policy for downloaded attachments, thumbnails, and raw repository...
authorGo MAEDA <maeda@farend.jp>
Mon, 18 Sep 2023 02:16:36 +0000 (02:16 +0000)
committerGo MAEDA <maeda@farend.jp>
Mon, 18 Sep 2023 02:16:36 +0000 (02:16 +0000)
Patch by Holger Just.

git-svn-id: https://svn.redmine.org/redmine/trunk@22295 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/attachments_controller.rb
app/controllers/repositories_controller.rb

index 06a236c2c0d7e6c00e81048587bfc05dbe6dfec2..414ecfde0c697bdd1c87d22a382ed18adefbde5a 100644 (file)
@@ -321,4 +321,9 @@ class AttachmentsController < ApplicationController
       request.raw_post
     end
   end
+
+  def send_file(path, options={})
+    headers['content-security-policy'] = "default-src 'none'; style-src 'unsafe-inline'; sandbox"
+    super
+  end
 end
index 8ecb0022ffe79e2ef54ecce359017f6f2a34efd0..3fb69e8b2060ec99d9895c01f1e0671fcd202799 100644 (file)
@@ -431,6 +431,11 @@ class RepositoriesController < ApplicationController
     end
   end
 
+  def send_file(path, options={})
+    headers['content-security-policy'] = "default-src 'none'; style-src 'unsafe-inline'; sandbox"
+    super
+  end
+
   def valid_name?(rev)
     return true if rev.nil?
     return true if REV_PARAM_RE.match?(rev)