Skip to content

feat(api-server): add basic security headers#3383

Closed
aydnOktay wants to merge 1 commit into
NousResearch:mainfrom
aydnOktay:fix/api-server-referrer-policy
Closed

feat(api-server): add basic security headers#3383
aydnOktay wants to merge 1 commit into
NousResearch:mainfrom
aydnOktay:fix/api-server-referrer-policy

Conversation

@aydnOktay

Copy link
Copy Markdown
Contributor

This PR adds a small, low-risk security hardening to the OpenAI-compatible API server.

  • Add security_headers_middleware that sets X-Content-Type-Options: nosniff and Referrer-Policy: no-referrer on all responses (including errors).
  • Wire the middleware into APIServerAdapter.connect.
  • Add a unit test to assert the headers are present.

Rationale: prevents MIME sniffing and avoids leaking referrer info when the API is accessed via a browser/proxy context.

@teknium1

Copy link
Copy Markdown
Contributor

Merged via #3576 — cherry-picked onto current main with authorship preserved, test added and live-verified. Thanks @aydnOktay!

@teknium1 teknium1 closed this Mar 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants