diff options
author | Jon Newson <jon_newson@ieee.org> | 2016-03-15 18:07:42 +1100 |
---|---|---|
committer | Jon Newson <jon_newson@ieee.org> | 2016-03-15 18:07:42 +1100 |
commit | a455353a811d4cf3a9c327750e9d0fb4c7ee229a (patch) | |
tree | 0c42f4a153df882d49b0448209ab0a1937e13685 /service/pixelated/resources/sandbox_resource.py | |
parent | 0ffeb6b70df00a54a2509179c32104bc7f883196 (diff) | |
parent | cf32471caf75b817b23339166002987726d3d6d8 (diff) |
Merge branch 'master' of https://github.com/pixelated/pixelated-user-agent
# By Felix Hammerl (13) and Thais Siqueira (3)
# Via Christoph (1) and Thais Siqueira (1)
* 'master' of https://github.com/pixelated/pixelated-user-agent:
Sets SSL certifications to false.
Fixes pep8 errors and update requests to 2.9.1.
Update locust test to run after xsrf token implementation.
Issue #620: Adapt unit tests to CSS changes
Issue #620: Refactor palceholder
Issue #620: Remove former main css file
Issue #620: Spike growl CSS modularization
Issue #617: Highlight search terms by altering mail content
Issue #617: Allow only >=3 alphanumeric characters in search field
Issue #617: Restrict searching to alphanumeric characters
Issue #617: Remove highlighting for sandboxed content
Issue #617: Add sandbox to build scripts
Issue #617: Add sandbox to user-agent
Issue #617: Create sandbox resouces
Issue #617: Add iframe-resizer
Issue #617: Serve content from Sandbox resource
Diffstat (limited to 'service/pixelated/resources/sandbox_resource.py')
-rw-r--r-- | service/pixelated/resources/sandbox_resource.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/service/pixelated/resources/sandbox_resource.py b/service/pixelated/resources/sandbox_resource.py new file mode 100644 index 00000000..28e8c9be --- /dev/null +++ b/service/pixelated/resources/sandbox_resource.py @@ -0,0 +1,34 @@ +# +# Copyright (c) 2016 ThoughtWorks, Inc. +# +# Pixelated is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Pixelated is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Pixelated. If not, see <http://www.gnu.org/licenses/>. + +from twisted.web.static import File + + +class SandboxResource(File): + CSP_HEADER_VALUES = "sandbox allow-popups allow-scripts;" \ + "default-src 'self';" \ + "style-src *;" \ + "script-src *;" \ + "font-src *;" \ + "img-src *;" \ + "object-src 'none';" \ + "connect-src 'none';" + + def render_GET(self, request): + request.setHeader('Content-Security-Policy', self.CSP_HEADER_VALUES) + request.setHeader('X-Content-Security-Policy', self.CSP_HEADER_VALUES) + request.setHeader('X-Webkit-CSP', self.CSP_HEADER_VALUES) + return super(SandboxResource, self).render_GET(request) |