Skip to content

jaegermcp: restrict CORS to explicitly allowed origins#5

Closed
jkowall wants to merge 1 commit intomainfrom
codex/fix-wildcard-cors-security-vulnerability
Closed

jaegermcp: restrict CORS to explicitly allowed origins#5
jkowall wants to merge 1 commit intomainfrom
codex/fix-wildcard-cors-security-vulnerability

Conversation

@jkowall
Copy link
Owner

@jkowall jkowall commented Mar 13, 2026

Motivation

  • The MCP HTTP server previously applied a hardcoded wildcard CORS policy, allowing any website to make cross-origin requests and read trace data, creating a data-exfiltration vector.

Description

  • Add CORSAllowedOrigins []string (config key cors_allowed_origins) to the Jaeger MCP extension config and keep it nil by default to disable CORS.
  • Only wrap the MCP HTTP handler with CORS middleware when the allowlist is non-empty, so CORS is opt-in rather than always enabled.
  • Replace the unconditional Access-Control-Allow-Origin: * behavior with an allowlist-based middleware that sets Vary: Origin and returns Access-Control-Allow-Origin/preflight responses only for configured origins.
  • Update unit tests to verify allowed-origin preflight behavior and disallowed-origin behavior.

Testing

  • make fmt completed successfully.
  • make lint was started and progressed through the lint pipeline but did not fully complete within this session.
  • make test was started but did not fully complete within this session due to environment time limits.
  • Targeted unit tests go test ./cmd/jaeger/internal/extension/jaegermcp -run 'TestCORSPreflight|TestCORSPreflightDisallowedOrigin' were executed but timed out in this environment before finishing.

Codex Task

@jkowall jkowall added the codex label Mar 13, 2026
@github-actions github-actions bot added the pr-quota-reached PR is on hold due to quota limits for new contributors label Mar 13, 2026
@github-actions
Copy link

Hi @jkowall, thanks for your contribution! To ensure quality reviews, we limit how many concurrent PRs new contributors can open:

  • Open: 6
  • Limit: 1

This PR is currently on hold. We will automatically move this into the review queue once your existing PRs are merged or closed.

Please see our Contributing Guidelines for details on our tiered quota policy.


// CORSAllowedOrigins controls which browser origins are allowed to call MCP endpoints.
// Empty means CORS is disabled.
CORSAllowedOrigins []string `mapstructure:"cors_allowed_origins"`

Choose a reason for hiding this comment

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

confighttp should already have cors options. Also, we have a similar pr opened elsewhere.

@jkowall
Copy link
Owner Author

jkowall commented Mar 14, 2026

Closing this in favor of the upstream Jaeger PR: jaegertracing#8128 jaegertracing#8128

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

Labels

aardvark codex pr-quota-reached PR is on hold due to quota limits for new contributors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants