fix(security): swap X-Frame-Options DENY for CSP frame-ancestors allowing HF Spaces embed
Browse files
tests/integration/test_health.py
CHANGED
|
@@ -21,4 +21,8 @@ async def test_readyz_when_analytics_disabled(client) -> None:
|
|
| 21 |
async def test_security_headers(client) -> None:
|
| 22 |
resp = await client.get("/v1/healthz")
|
| 23 |
assert resp.headers.get("X-Content-Type-Options") == "nosniff"
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
async def test_security_headers(client) -> None:
|
| 22 |
resp = await client.get("/v1/healthz")
|
| 23 |
assert resp.headers.get("X-Content-Type-Options") == "nosniff"
|
| 24 |
+
# Embedding policy is enforced via CSP ``frame-ancestors`` (allows the HF
|
| 25 |
+
# Spaces hub to iframe the app), not the legacy ``X-Frame-Options`` header.
|
| 26 |
+
csp = resp.headers.get("Content-Security-Policy", "")
|
| 27 |
+
assert "frame-ancestors" in csp
|
| 28 |
+
assert "huggingface.co" in csp
|