summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2016-09-05 17:55:43 +0100
committerGitHub <noreply@github.com>2016-09-05 17:55:43 +0100
commit9b69c85f7ce98dacab6a585dc76dd8706650686e (patch)
tree748bec14aa38ea45e254adec81e9c6f398fab368 /synapse
parentMerge pull request #1070 from matrix-org/erikj/presence_stats (diff)
parentAdd quotes and be explicity about script-src (diff)
downloadsynapse-9b69c85f7ce98dacab6a585dc76dd8706650686e.tar.xz
Merge pull request #1071 from matrix-org/erikj/pdf_fix
Allow PDF to be rendered from media repo
Diffstat (limited to 'synapse')
-rw-r--r--synapse/rest/media/v1/download_resource.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/synapse/rest/media/v1/download_resource.py b/synapse/rest/media/v1/download_resource.py
index 9f0625a822..a45ee9483e 100644
--- a/synapse/rest/media/v1/download_resource.py
+++ b/synapse/rest/media/v1/download_resource.py
@@ -45,7 +45,14 @@ 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';"
+            " script-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)