Secure, Fast, and Extensible Sandbox runtime for AI agents.
fix(ingress): match the status endpoints on the escaped path
Maohao6379e8439636
diff --git a/components/ingress/main.go b/components/ingress/main.goindex c2e39f874..16a2d52b9 100644--- a/components/ingress/main.go+++ b/components/ingress/main.go@@ -255,10 +255,12 @@ func newNetworkReadiness(config connectivity.TrackerConfig) (connectivity.Observ// newIngressHandler serves the status endpoints and proxies everything else.// It does not use http.ServeMux, which answers paths with "//", "." or ".."// segments with a redirect to the cleaned path instead of passing them on;-// the sandbox application owns its paths.+// the sandbox application owns its paths. The status paths are matched in+// escaped form, so a sandbox path such as /status.ok%2Fnetwork-readiness is+// proxied rather than read as a status endpoint.func newIngressHandler(reverseProxy, networkReadiness http.Handler) http.Handler {return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {- switch r.URL.Path {+ switch r.URL.EscapedPath() {case "/status.ok":proxy.Healthz(w, r)case "/status.ok/network-readiness":diff --git a/components/ingress/main_test.go b/components/ingress/main_test.goindex c0742a4c6..85566fd77 100644--- a/components/ingress/main_test.go+++ b/components/ingress/main_test.go@@ -68,4 +68,12 @@ func TestIngressHandlerServesStatusPaths(t *testing.T) {if got != "proxy GET /status.ok/other" {t.Errorf("/status.ok/other handled as %q; want it proxied", got)}++ // An encoded slash is part of a sandbox path, not a status endpoint.+ got = ""+ rec = httptest.NewRecorder()+ handler.ServeHTTP(rec, httptest.NewRequest(http.MethodGet, "/status.ok%2Fnetwork-readiness", nil))+ if got != "proxy GET /status.ok/network-readiness" {+ t.Errorf("/status.ok%%2Fnetwork-readiness handled as %q; want it proxied", got)+ }}