Skip to content

Send X-Content-Type-Options: nosniff on every response - #62

Merged
markmnl merged 2 commits into
mainfrom
nosniff
Oct 29, 2026
Merged

markmnl merged 2 commits into
mainfrom
nosniff

Conversation

@markmnl

@markmnl markmnl commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Attachments (GET /fmsg/:id/attach/:filename) and message data (GET /fmsg/:id/data) are served with a Content-Type from the file extension and no nosniff, so a browser could sniff an uploaded file as HTML. Content-Disposition: attachment already makes this hard; this closes it.

  • New middleware.SecurityHeaders() sets X-Content-Type-Options: nosniff. It's registered globally, so it covers every route, including 404s.
  • TestSecurityHeadersSetsNosniff.
  • README note under API Routes.

🤖 Generated with Claude Code

Attachments and message data were served with a type from the file
extension and no nosniff, so a browser could sniff an uploaded file as
HTML. A small middleware now sets the header on all routes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@markmnl
markmnl enabled auto-merge (squash) October 29, 2026 13:08
@markmnl
markmnl disabled auto-merge October 29, 2026 13:31
@markmnl
markmnl merged commit 2108170 into main Oct 29, 2026
1 check passed
@markmnl
markmnl deleted the nosniff branch October 29, 2026 13:32
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.

1 participant