lamhieu commited on
Commit
4254925
·
1 Parent(s): 611e6bb

fix(security): swap X-Frame-Options DENY for CSP frame-ancestors allowing HF Spaces embed

Browse files
Files changed (1) hide show
  1. tests/integration/test_health.py +5 -1
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
- assert resp.headers.get("X-Frame-Options") == "DENY"
 
 
 
 
 
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