fix(terminal): ignore invalid shell config from race condition
All checks were successful
Beta Release / beta (push) Successful in 40s

Reject shell paths with length <= 1 to prevent errors when user
input is accidentally sent as init message.

Assisted-by: MiniMax-M2.7 via Crush <crush@charm.land>
This commit is contained in:
Augustin
2026-04-22 18:56:33 +02:00
parent 4fd599adec
commit 8af6d25e28

View File

@@ -105,6 +105,12 @@ func (s *Server) handleTerminalWS(w http.ResponseWriter, r *http.Request) {
} }
} }
// Ignore invalid shell paths (e.g., single characters from race condition)
if len(shell) <= 1 {
conn.WriteJSON(wsMessage{Type: "error", Data: "invalid shell config"})
return
}
if _, err := os.Stat(shell); err != nil { if _, err := os.Stat(shell); err != nil {
conn.WriteJSON(wsMessage{Type: "error", Data: fmt.Sprintf("shell not found: %s", shell)}) conn.WriteJSON(wsMessage{Type: "error", Data: fmt.Sprintf("shell not found: %s", shell)})
return return