mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-07 08:02:23 +00:00
[agent] fix: harden api server response headers
This commit is contained in:
parent
b389796ae3
commit
5631345b12
2 changed files with 10 additions and 0 deletions
|
|
@ -510,7 +510,12 @@ else:
|
|||
body_limit_middleware = None # type: ignore[assignment]
|
||||
|
||||
_SECURITY_HEADERS = {
|
||||
"Content-Security-Policy": "default-src 'none'; frame-ancestors 'none'",
|
||||
"Permissions-Policy": "camera=(), microphone=(), geolocation=()",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-Frame-Options": "DENY",
|
||||
"X-XSS-Protection": "0",
|
||||
"Referrer-Policy": "no-referrer",
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -445,7 +445,12 @@ class TestHealthEndpoint:
|
|||
async with TestClient(TestServer(app)) as cli:
|
||||
resp = await cli.get("/health")
|
||||
assert resp.status == 200
|
||||
assert resp.headers.get("Content-Security-Policy") == "default-src 'none'; frame-ancestors 'none'"
|
||||
assert resp.headers.get("Permissions-Policy") == "camera=(), microphone=(), geolocation=()"
|
||||
assert resp.headers.get("Strict-Transport-Security") == "max-age=31536000; includeSubDomains"
|
||||
assert resp.headers.get("X-Content-Type-Options") == "nosniff"
|
||||
assert resp.headers.get("X-Frame-Options") == "DENY"
|
||||
assert resp.headers.get("X-XSS-Protection") == "0"
|
||||
assert resp.headers.get("Referrer-Policy") == "no-referrer"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue