stacklok / stacklok/toolhive

Add allowedOrigins to workload CRDs + operator wiring

Open
#5,399 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement kubernetes operator security
Dominant language
Go
Stars
2.2k
Forks
300
Avg merge
1d 15h
Merged PRs (30d)
184

Description

Follow-up from #4908 (Origin header validation for DNS-rebind protection)

#4908 adds Origin-header validation to the CLI/proxyrunner path via the --allowed-origins flag and the origin middleware. The operator path is not yet covered: MCPServerSpec, MCPRemoteProxySpec, and VirtualMCPServerSpec have no allowedOrigins field, and operator-deployed pods bind to non-loopback addresses. As a result origin.ResolveAllowedOrigins returns nil and the middleware is skipped (with a WARN), so Kubernetes deployments currently ship with Origin validation disabled.

Scope
  • Add an allowedOrigins []string field to the workload CRDs (MCPServer / MCPRemoteProxy / VirtualMCPServer).
  • Serialize it into the generated RunConfig so the proxyrunner pod's middleware chain enforces it.
  • Regenerate CRDs/docs and add controller tests.
Context
  • Middleware + flag landed in #4908.
  • Relates to the MCP 2025-11-25 §"Security Warning" spec-compliance work.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating MCPServerSpec, MCPRemoteProxySpec, and VirtualMCPServerSpec, then trace the existing allowed-origins flag and origin middleware from #4908 into RunConfig serialization. Inspect CRD and documentation generation plus the controller test setup. Done means all three workload CRDs expose allowedOrigins, generated configuration reaches the proxyrunner middleware, and controller tests cover the wiring.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
infrastructure, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.