Skip to content

docs(mcp): document Origin validation / CORS secure defaults#530

Draft
kylebernhardy wants to merge 1 commit into
mainfrom
docs/mcp-origin-cors-1317
Draft

docs(mcp): document Origin validation / CORS secure defaults#530
kylebernhardy wants to merge 1 commit into
mainfrom
docs/mcp-origin-cors-1317

Conversation

@kylebernhardy

Copy link
Copy Markdown
Member

Companion to HarperFast/harper#1320 (issue HarperFast/harper#1317, S4).

Adds a Security: Origin validation section to reference/mcp/configuration.md documenting that the MCP endpoint validates the Origin header (DNS-rebinding defense) via each profile's existing CORS config, and that any deployment exposing MCP to browsers beyond loopback should enable an explicit CORS allow-list to activate that protection.

No new config surface — the behavior already ships; this fills a documentation gap surfaced while fixing #1317. format:check is clean.

Generated by an LLM (Claude Opus 4.8).

🤖 Generated with Claude Code

Add a Security section to the MCP configuration reference explaining that
the MCP endpoint validates the Origin header (DNS-rebinding defense) via each
profile's CORS config, and that deployments exposing MCP to browsers beyond
loopback should enable an explicit CORS allow-list.

Companion to HarperFast/harper#1320 (#1317 S4).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a new "Security: Origin validation" section to the MCP configuration documentation, detailing how the endpoint validates the Origin header to defend against DNS-rebinding attacks. The review feedback suggests correcting an inaccuracy regarding the default CORS configuration state to ensure the documentation is precise.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.


The MCP endpoint validates the request `Origin` header to defend against DNS-rebinding attacks (a requirement of the MCP Streamable HTTP transport). Validation reuses each profile's existing CORS configuration rather than introducing a separate MCP setting:

- When CORS is **disabled** (the default), any `Origin` is accepted. This is appropriate for localhost-only or non-browser clients, where no DNS-rebinding vector exists.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

According to the HTTP configuration documentation, http.cors defaults to true (enabled), but http.corsAccessList defaults to null (allowing all origins). Therefore, CORS is not disabled by default; rather, it is enabled without an active allow-list. We should clarify this to avoid confusing users about the default configuration state.

Suggested change
- When CORS is **disabled** (the default), any `Origin` is accepted. This is appropriate for localhost-only or non-browser clients, where no DNS-rebinding vector exists.
- When CORS is **disabled** or no allow-list is configured (the default), any Origin is accepted. This is appropriate for localhost-only or non-browser clients, where no DNS-rebinding vector exists.

@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-530

This preview will update automatically when you push new commits.

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