Documentation
¶
Overview ¶
Package proxy owns the UI's fixed upstream routes, browser credential exchange, CSRF checks and response filtering. Bootstrap injects the session store and HTTP client; callers cannot supply arbitrary proxy destinations.
Index ¶
Constants ¶
const ( DefaultRuntimeUpstream = "http://mcp-runtime-api.mcp-platform.svc.cluster.local:8084" DefaultAnalyticsUpstream = "http://mcp-analytics-api.mcp-observability.svc.cluster.local:8085" SessionAPIPrefix = "/api/ui/v1" )
const CSRFHeaderName = "X-CSRF-Token"
CSRF protection for the cookie-backed UI session proxy.
The session cookie is SameSite=Strict, which already blocks the common cross-site form/fetch vectors, but SameSite is a defense-in-depth control rather than a guarantee: it is browser-enforced, has historically varied across implementations, and does nothing for a same-site subdomain attacker. Any state-changing route reached with an ambient cookie therefore carries its own token.
This is a synchroniser-token scheme rather than a double-submit cookie: the authoritative token lives in the server-side session record, so an attacker who can set cookies on the origin still cannot forge a matching pair. The token is handed to same-origin JavaScript in the /auth/login and /auth/status bodies; the same-origin policy is what keeps a cross-origin page from reading it.
Variables ¶
This section is empty.
Functions ¶
func NewGrafanaProxy ¶
func NewGrafanaProxy(platformBase, runtimeBase *url.URL, store *session.Store, prefix string, httpClient *http.Client) http.Handler
The platform session is the only browser credential accepted here. Every request is reauthenticated by runtime-api, including admin requests, so a stale UI role or a surviving Grafana cookie never grants data access.
func NewHTTPClient ¶
NewHTTPClient retains the browser proxy's bounded, non-redirecting transport.
Types ¶
type SessionProxy ¶
type SessionProxy struct {
// contains filtered or unexported fields
}
func NewSessionProxy ¶
func (*SessionProxy) ServeHTTP ¶
func (p *SessionProxy) ServeHTTP(w http.ResponseWriter, r *http.Request)