Skip to content

Commit

Permalink
Disable X-XSS protection by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonakemon committed Jul 25, 2023
1 parent 20055a7 commit 9b7c766
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion flask_talisman/talisman.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def init_app(
session_cookie_http_only=True,
session_cookie_samesite=DEFAULT_SESSION_COOKIE_SAMESITE,
x_content_type_options=True,
x_xss_protection=True):
x_xss_protection=False):
"""
Initialization.
Expand Down
9 changes: 8 additions & 1 deletion flask_talisman/talisman_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def testDefaults(self):
'X-Frame-Options': 'SAMEORIGIN',
'Strict-Transport-Security':
'max-age=31556926; includeSubDomains',
'X-XSS-Protection': '1; mode=block',
'X-Content-Type-Options': 'nosniff',
'Referrer-Policy': 'strict-origin-when-cross-origin'
}
Expand Down Expand Up @@ -85,6 +84,14 @@ def testForceSslOptionOptions(self):
response = self.client.get('/')
self.assertEqual(response.status_code, 200)

def testForceXSSProtectionOptions(self):
self.talisman.x_xss_protection = True

# HTTP request from Proxy
response = self.client.get('/')
self.assertIn('X-XSS-Protection', response.headers)
self.assertEqual(response.headers['X-XSS-Protection'], '1; mode=block')

def testHstsOptions(self):
self.talisman.force_ssl = False

Expand Down

0 comments on commit 9b7c766

Please sign in to comment.