From 662b031a30b85811469921e1d61fcf35775917eb Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Mon, 5 Sep 2016 16:43:30 +0100 Subject: Allow PDF to be rendered from media repo --- synapse/rest/media/v1/download_resource.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'synapse') 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) -- cgit 1.4.1 From d51b8a1674974ec0d694f86e6a911f45efba643a Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Mon, 5 Sep 2016 17:35:01 +0100 Subject: Add quotes and be explicity about script-src --- synapse/rest/media/v1/download_resource.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'synapse') diff --git a/synapse/rest/media/v1/download_resource.py b/synapse/rest/media/v1/download_resource.py index e3843c1be5..a45ee9483e 100644 --- a/synapse/rest/media/v1/download_resource.py +++ b/synapse/rest/media/v1/download_resource.py @@ -47,7 +47,8 @@ class DownloadResource(Resource): def _async_render_GET(self, request): request.setHeader( "Content-Security-Policy", - "default-src none;" + "default-src 'none';" + " script-src 'none';" " plugin-types application/pdf;" " style-src 'unsafe-inline';" " object-src 'self';" -- cgit 1.4.1