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

Ouverte Adaptée aux débutants
#3,783 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 2 jours

@AdaAibaby y travaille déjà.

Depuis le 2/11/2026.

  • #3784 par @AdaAibaby — ouverte
  • #3785 par @AdaAibaby — ouverte

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
72/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
go
Domaine
backend

Piste de recherche

Le changement se situe dans la branche ErrInvalidHost de handler() dans packages/shared/pkg/proxy/handler.go, qui utilise isLocalRequestHost de host.go et une vérification d'en-tête de routage. Lisez d'abord ces fonctions auxiliaires, puis ajoutez un test unitaire pour un Host qui n'est qu'une IP, sans les en-têtes E2b-Sandbox-Id/E2b-Sandbox-Port. C'est terminé lorsque ce cas journalise en Debug, qu'un host de domaine mal formé journalise toujours en Warn, et que la réponse 400 reste inchangée. Faites valider la direction par un mainteneur avant d'ouvrir la PR.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
Go
Étoiles
1.8k
Forks
503
Métriques de merge des PR
Aucune PR mergée en 30 j

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de e2b-dev/runtime

Toutes les issues de e2b-dev/runtime

Issues similaires

Plus d'issues Go

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.