client-proxy: WARN "invalid host" spam from unroutable bare-IP Host requests (external probes)

Aperta Adatta ai principianti
#3,783 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@AdaAibaby ci sta già lavorando.

Dal 2/11/2026.

  • #3784 di @AdaAibaby — aperta
  • #3785 di @AdaAibaby — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
backend

Direzione di ricerca

La modifica riguarda il ramo ErrInvalidHost di handler() in packages/shared/pkg/proxy/handler.go, che usa isLocalRequestHost da host.go e un controllo dell'header di routing. Leggi prima questi helper, poi aggiungi un test unitario per un Host che è solo un IP, senza gli header E2b-Sandbox-Id/E2b-Sandbox-Port. È completato quando questo caso logga a livello Debug, un host di dominio malformato logga ancora a livello Warn e la risposta 400 resta invariata. Conferma la direzione con un maintainer prima di aprire la PR.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

client-proxy logs WARN "invalid host" for every inbound request whose Host is a bare IP address with no sandbox routing headers. On any proxy with a public endpoint these arrive continuously from external scanners, health probes, and stale clients still pointed at an old node IP, producing ~1 line/second of WARN noise that drowns real warnings.

Observed (client-proxy):

WARN  invalid host  {"service":"client-proxy","host":"118.196.30.209"}
WARN  invalid host  {"service":"client-proxy","host":"118.196.30.209"}
... (repeats every ~1s)
Why these are expected, not warnings

packages/shared/pkg/proxy/handler.go rejects the request with ErrInvalidHost and returns 400, which is correct. But a bare-IP Host cannot encode sandbox routing ({port}-{sandboxID}.{domain}) — as isLocalRequestHost in host.go documents, header-based routing is the only mechanism that can work for an IP host. So an IP Host that also carries no routing headers (E2b-Sandbox-Id / E2b-Sandbox-Port) is, by construction, unroutable. Rejecting it is the designed behavior; logging it at WARN on every hit just turns routine external traffic into log spam.

(Header-based routing for IP hosts — #2581 — is unaffected: an IP host with routing headers routes fine and never reaches this branch.)

Proposal

In the ErrInvalidHost branch of handler(), log at Debug when the host is a raw IP / localhost and no routing headers are present (isLocalRequestHost(r.Host) && !hasRoutingHeaders(r.Header)), and keep Warn for a genuinely suspect invalid host (a malformed domain host), which is rare and worth visibility. Status code stays 400 in both cases — this only changes log level, not behavior.

Environment

Reproduced on client-proxy main; the proxy sits behind a public ingress, so any internet host hitting the raw IP triggers it. Same code path in api (OpenAPI validator logs the same raw-IP / requests as 404 no matching operation), but the client-proxy WARN is the loudest.

Happy to send the PR (small, with a unit test) if the direction is acceptable.

Lingua principale
Go
Stelle
1.8k
Fork
503
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di e2b-dev/runtime

Tutte le issue di e2b-dev/runtime

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.