Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Fix CSP #4250

Merged
merged 5 commits into from
Dec 22, 2016
Merged

Fix CSP #4250

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions gratipay/security/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ def add_headers_to_response(response):
# Allow fonts from cloud.typography.com.
if 'content-security-policy' not in response.headers:
response.headers['content-security-policy'] = ("default-src 'self';"
'script-src assets.gratipay.com;'
'style-src assets.gratipay.com;'
"script-src assets.gratipay.com 'unsafe-inline';"
'style-src assets.gratipay.com cloud.typography.com;'
'img-src *;'
'font-src cloud.typography.com;'
'font-src assets.gratipay.com cloud.typography.com;'
'upgrade-insecure-requests;'
'block-all-mixed-content;'
'reflected-xss block;')
8 changes: 4 additions & 4 deletions tests/py/test_security.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ def test_ahtr_sets_x_xss_protection(self):

def test_ahtr_sets_content_security_policy(self):
headers = self.client.GET('/about/').headers
policy = ('default-src \'self\';'
'script-src assets.gratipay.com;'
'style-src assets.gratipay.com;'
policy = ("default-src 'self';"
"script-src assets.gratipay.com 'unsafe-inline';"
'style-src assets.gratipay.com cloud.typography.com;'
'img-src *;'
'font-src cloud.typography.com;'
'font-src assets.gratipay.com cloud.typography.com;'
'upgrade-insecure-requests;'
'block-all-mixed-content;'
'reflected-xss block;')
Expand Down