Skip to content

fix(api-server): add browser security headers#26814

Closed
lidge-jun wants to merge 1 commit into
NousResearch:mainfrom
lidge-jun:codex/7487-api-security-headers
Closed

fix(api-server): add browser security headers#26814
lidge-jun wants to merge 1 commit into
NousResearch:mainfrom
lidge-jun:codex/7487-api-security-headers

Conversation

@lidge-jun

Copy link
Copy Markdown
Contributor

Summary

  • Add the missing defense-in-depth browser security headers to the OpenAI-compatible API server responses.
  • Keep the existing middleware behavior of using setdefault, so route handlers can still override a header intentionally.
  • Extend the existing /health regression test to lock the full security header set.

Closes #7487.

Verification

Real environment tested: macOS local workstation, Python 3.11.13 via existing Hermes worktree venv, Hermes built from source at this PR head.

Commands run after this patch:

scripts/run_tests.sh tests/gateway/test_api_server.py
.venv/bin/python -m ruff check gateway/platforms/api_server.py tests/gateway/test_api_server.py
git diff --check

Evidence after fix:

scripts/run_tests.sh tests/gateway/test_api_server.py
146 passed, 95 warnings in 2.67s

.venv/bin/python -m ruff check gateway/platforms/api_server.py tests/gateway/test_api_server.py
All checks passed!

git diff --check
(no output)

What was not tested: live HTTPS deployment behavior behind a reverse proxy; this patch covers the response header middleware directly through the aiohttp test server.

@alt-glitch alt-glitch added type/security Security vulnerability or hardening P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery labels May 16, 2026
@lidge-jun lidge-jun force-pushed the codex/7487-api-security-headers branch from 09597bd to 394e3fb Compare May 17, 2026 03:33
teknium1 added a commit that referenced this pull request May 17, 2026
…tors

Adds release-note attribution mappings for 9 contributors from group 4:
- @EloquentBrush0x (PR #26657)
- @subtract0 (PR #25658)
- @zwolniony (PR #26961)
- @that-ambuj (PR #26582)
- @zccyman (PR #25294)
- @lidge-jun (PR #26814)
- @phoenixshen (PR #26768)
- @AhmetArif0 (PR #26635)
- (francip already mapped from prior PR #26134 attribution)

#27147 dropped from this batch — already landed on main as 4b17c24.
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #27308 — your commit was cherry-picked onto current main as part of a batch salvage of low-risk new-contributor PRs. Authorship preserved (fix(api-server): add browser security headers). Thanks for the contribution.

@teknium1 teknium1 closed this May 17, 2026
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…tors

Adds release-note attribution mappings for 9 contributors from group 4:
- @EloquentBrush0x (PR NousResearch#26657)
- @subtract0 (PR NousResearch#25658)
- @zwolniony (PR NousResearch#26961)
- @that-ambuj (PR NousResearch#26582)
- @zccyman (PR NousResearch#25294)
- @lidge-jun (PR NousResearch#26814)
- @phoenixshen (PR NousResearch#26768)
- @AhmetArif0 (PR NousResearch#26635)
- (francip already mapped from prior PR NousResearch#26134 attribution)

NousResearch#27147 dropped from this batch — already landed on main as 4b17c24.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have type/security Security vulnerability or hardening

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Security] Missing security headers on API server responses (CSP, X-Frame-Options, HSTS)

3 participants