about summary refs log tree commit diff
path: root/app/controllers/media_controller.rb
diff options
context:
space:
mode:
authorjomo <github@jomo.tv>2018-12-18 16:40:30 +0100
committerEugen Rochko <eugen@zeonfederated.com>2018-12-18 16:40:30 +0100
commit2c1a6f746fdce3654590cb2cb6703db24148cf59 (patch)
tree1af2b15afc981d9aba4983a8301a7106697d7846 /app/controllers/media_controller.rb
parent857e8eb312bc1767d6d04c5490c2acb3b787cf9a (diff)
fix CSP / X-Frame-Options for media embeds (#9558)
Diffstat (limited to 'app/controllers/media_controller.rb')
-rw-r--r--app/controllers/media_controller.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/controllers/media_controller.rb b/app/controllers/media_controller.rb
index 88c7232dd..8e1624ce1 100644
--- a/app/controllers/media_controller.rb
+++ b/app/controllers/media_controller.rb
@@ -6,12 +6,17 @@ class MediaController < ApplicationController
   before_action :set_media_attachment
   before_action :verify_permitted_status!
 
+  content_security_policy only: :player do |p|
+    p.frame_ancestors(false)
+  end
+
   def show
     redirect_to @media_attachment.file.url(:original)
   end
 
   def player
     @body_classes = 'player'
+    response.headers['X-Frame-Options'] = 'ALLOWALL'
     raise ActiveRecord::RecordNotFound unless @media_attachment.video? || @media_attachment.gifv?
   end