Bump utils and sanitise header values

Updated notifications-utils. This brings in
- the renamed character sanitization classes
- the change to allow unicode in letter addresses (this lets us delete
a test that is no longer relevant)

Also replaced non-ascii characters in headers. This fixes a bug where
non-ascii characters in a CSV filename were causing errors since the
filename is also used in the header.
This commit is contained in:
Katie Smith
2018-05-25 10:18:39 +01:00
parent 3459f74110
commit 58cc1604a7
5 changed files with 23 additions and 52 deletions

View File

@@ -16,3 +16,20 @@ def test_owasp_useful_headers_set(client, mocker):
"img-src 'self' *.google-analytics.com *.notifications.service.gov.uk static-logos.test.com data:;"
"frame-src www.youtube.com;"
)
def test_headers_non_ascii_characters_are_replaced(client, mocker):
mocker.patch('app.get_cdn_domain', return_value='static-logos۾.test.com')
response = client.get('/')
assert response.status_code == 200
assert response.headers['Content-Security-Policy'] == (
"default-src 'self' 'unsafe-inline';"
"script-src 'self' *.google-analytics.com 'unsafe-inline' 'unsafe-eval' data:;"
"connect-src 'self' *.google-analytics.com;"
"object-src 'self';"
"font-src 'self' data:;"
"img-src 'self' *.google-analytics.com *.notifications.service.gov.uk static-logos??.test.com data:;"
"frame-src www.youtube.com;"
)