Skip to content

server: restrict default CORS to allowed origins#1074

Open
TheodorNEngoy wants to merge 1 commit intomodelcontextprotocol:mainfrom
TheodorNEngoy:codex/restrict-cors-defaults
Open

server: restrict default CORS to allowed origins#1074
TheodorNEngoy wants to merge 1 commit intomodelcontextprotocol:mainfrom
TheodorNEngoy:codex/restrict-cors-defaults

Conversation

@TheodorNEngoy
Copy link

The inspector server currently installs cors() with default (permissive) settings.

This PR makes the default CORS policy match the existing origin allowlist logic:

  • Allow only ALLOWED_ORIGINS (comma-separated) or default to loopback origins based on CLIENT_PORT.
  • Still allows non-browser clients (no Origin header).
  • Keeps the existing originValidationMiddleware in place (defense in depth).

This reduces the blast radius if the proxy auth is disabled (DANGEROUSLY_OMIT_AUTH) or misconfigured.

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