mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #32678 -- Removed SECURE_BROWSER_XSS_FILTER setting.
This commit is contained in:
committed by
Mariusz Felisiak
parent
8bcb00858e
commit
54da6e2ac2
@@ -175,34 +175,6 @@ class SecurityMiddlewareTest(SimpleTestCase):
|
||||
"""
|
||||
self.assertNotIn('X-Content-Type-Options', self.process_response().headers)
|
||||
|
||||
@override_settings(SECURE_BROWSER_XSS_FILTER=True)
|
||||
def test_xss_filter_on(self):
|
||||
"""
|
||||
With SECURE_BROWSER_XSS_FILTER set to True, the middleware adds
|
||||
"s-xss-protection: 1; mode=block" header to the response.
|
||||
"""
|
||||
self.assertEqual(
|
||||
self.process_response().headers['X-XSS-Protection'],
|
||||
'1; mode=block',
|
||||
)
|
||||
|
||||
@override_settings(SECURE_BROWSER_XSS_FILTER=True)
|
||||
def test_xss_filter_already_present(self):
|
||||
"""
|
||||
The middleware will not override an "X-XSS-Protection" header
|
||||
already present in the response.
|
||||
"""
|
||||
response = self.process_response(secure=True, headers={"X-XSS-Protection": "foo"})
|
||||
self.assertEqual(response.headers["X-XSS-Protection"], "foo")
|
||||
|
||||
@override_settings(SECURE_BROWSER_XSS_FILTER=False)
|
||||
def test_xss_filter_off(self):
|
||||
"""
|
||||
With SECURE_BROWSER_XSS_FILTER set to False, the middleware does not
|
||||
add an "X-XSS-Protection" header to the response.
|
||||
"""
|
||||
self.assertNotIn('X-XSS-Protection', self.process_response().headers)
|
||||
|
||||
@override_settings(SECURE_SSL_REDIRECT=True)
|
||||
def test_ssl_redirect_on(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user