Coding-agent terminals never connect when the apps host is 32 characters or longer (ttyd --check-origin)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 49/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- go, helm, kubernetes
- Área
- backend, networking
Línea de trabajo
Start with the four ttyd templates at deploy/helm/javo/files/templates/{pi,claude-code,herdr,terminal}.yaml and the gateway origin check at internal/gateway/proxy/proxy.go:650. Check how NetworkPolicy restricts access to app pods, then assess removing --check-origin and adding a gateway test with an apps host of at least 32 characters. Done when terminals connect through the gateway and the regression test covers the long-host case.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
On a NIC cluster on AWS, every coding-agent terminal showed "Press Enter to Reconnect" and never connected. ttyd logged this on each attempt:
refuse to serve WS client from different origin due to the --check-origin option.
User code denied connection
The apps host there was javo-apps.int-hub-dev.openteams.dev, which is 35 characters. ttyd 1.7.7 with --check-origin refuses any websocket whose Origin host is 32 characters or longer, even when Host matches it exactly. The pi, claude-code, herdr and terminal templates all pass that flag (deploy/helm/javo/files/templates/{pi,claude-code,herdr,terminal}.yaml).
Repro
I bypassed the gateway, port-forwarded straight to a pi pod's ttyd on 7681, and sent a websocket handshake with Host: H and Origin: https://H:
| Host length | Result |
|---|---|
| 4, 22, 28, 29, 30, 31 | 101 Switching Protocols |
| 32, 33, 35, 38 | connection refused, same log line |
The gateway is not involved. It keeps Host as is (internal/gateway/proxy/proxy.go:309), and its own same-origin check (foreignOrigin, proxy.go:650) passes for the same request.
Why
check_host_origin in ttyd 1.7.7 (src/protocol.c) parses the Origin header in place with lws_parse_uri, which leaves address pointing inside buf, and then runs sprintf(buf, "%s", address). Source and destination overlap, which is undefined behaviour. A 32-byte limit fits a copy routine that moves 32 bytes at a time and only goes wrong past that. This is inferred from the code and the measured limit. Patching in a separate buffer and re-running the table above would confirm or rule it out. ttyd main swapped sprintf for snprintf (tsl0922/ttyd@e2819f2), which still overlaps, so upgrading ttyd may not fix it. tsl0922/ttyd#1566 is a different --check-origin failure (HTTP/2).
Who hits it
Anyone whose apps host is 32 characters or longer. javo-pack defaults to javo-apps.<domain> (values.yaml:164), so that's every domain of 22 characters or more. The Hetzner deploy at javo-apps.nebari.openteams.app is 30, which is why it works there.
Workaround today: an apps host of 31 characters or fewer. On the AWS cluster apps.int-hub-dev.openteams.dev (30) fixed it, and the pi terminal connected and answered.
What I think we should do
Drop --check-origin from the four templates. The gateway already refuses a websocket from a foreign origin before it reaches the app, and with NetworkPolicy enforced (allow-gateway-only in javo-apps) only the gateway can reach app pods, so ttyd's own check adds nothing we rely on. A test that opens an agent terminal through the gateway with a long apps host would keep this from coming back. Separately, we should report the overlap upstream to ttyd.
- Lenguaje dominante
- Go
- Estrellas
- 5
- Forks
- 0
- Merge medio
- 21 h 13 min
- PR fusionados (30 d)
- 53
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de nebari-dev/tapas
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
nebari-dev/tapas#124 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
nebari-dev/tapas#121 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
nebari-dev/tapas#32 ·
Los mantenedores suelen responder en 1 día
-
Suggest saving a memory when a chat message holds something worth rememberingPosiblemente ocupada @jbouder la tomó hoy. Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
nebari-dev/tapas#137 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 54/100
nebari-dev/tapas#136 ·
Los mantenedores suelen responder en 1 día
Todos los issues de nebari-dev/tapas
Issues similares
-
--auto-tier: hashing, dedup, resume validation and DVC/git reads still update atime on LinuxAbiertoarea: pipeline priority: low type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
prime-radiant-inc/evener#8335 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
-
ui: OnTextKey on SearchField never sees keys (it does not reach the inner input)Posiblemente ocupada @szluyu99 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100