summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-09-05 16:43:30 +0100
committerErik Johnston <erik@matrix.org>2016-09-05 17:25:26 +0100
commit662b031a30b85811469921e1d61fcf35775917eb (patch)
treed2d6b2f75b87ff323f5e097fbcbe23575f37efc0
parentMerge pull request #1070 from matrix-org/erikj/presence_stats (diff)
downloadsynapse-662b031a30b85811469921e1d61fcf35775917eb.tar.xz
Allow PDF to be rendered from media repo
-rw-r--r--synapse/rest/media/v1/download_resource.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/rest/media/v1/download_resource.py b/synapse/rest/media/v1/download_resource.py
index 9f0625a822..e3843c1be5 100644
--- a/synapse/rest/media/v1/download_resource.py
+++ b/synapse/rest/media/v1/download_resource.py
@@ -45,7 +45,13 @@ class DownloadResource(Resource):
     @request_handler()
     @defer.inlineCallbacks
     def _async_render_GET(self, request):
-        request.setHeader("Content-Security-Policy", "sandbox")
+        request.setHeader(
+            "Content-Security-Policy",
+            "default-src none;"
+            " plugin-types application/pdf;"
+            " style-src 'unsafe-inline';"
+            " object-src 'self';"
+        )
         server_name, media_id, name = parse_media_id(request)
         if server_name == self.server_name:
             yield self._respond_local_file(request, media_id, name)