"""HTTP hardening, error disclosure, and template escaping."""
import pytest
from app.app import nl2br
class TestSecurityHeaders:
def test_core_headers_are_present(self, client):
headers = client.get('/auth/login').headers
assert headers['X-Content-Type-Options'] == 'nosniff'
assert headers['X-Frame-Options'] == 'DENY'
assert headers['Referrer-Policy'] == 'strict-origin-when-cross-origin'
assert 'frame-ancestors' in headers['Content-Security-Policy']
def test_deprecated_xss_auditor_header_is_not_sent(self, client):
"""X-XSS-Protection was removed: deprecated, and harmful in its
last implementations."""
assert 'X-XSS-Protection' not in client.get('/auth/login').headers
@pytest.mark.xfail(
strict=True,
reason="SEC-WEB-001: 15 inline \nsecond'))
assert '